Cod sursa(job #1032564)

Utilizator danalex97Dan H Alexandru danalex97 Data 15 noiembrie 2013 19:39:38
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.47 kb
#include <fstream>
using namespace std;

ifstream F("dtcsu.in");
ofstream G("dtcsu.out");

const int skip = 276997;
int q,out;
long long x;

int v[] = { 2 , 3 , 5 , 7 , 11 , 0 };

int main()
{
    for (int i=0;i<skip;++i)
        F>>x;
    F>>q;
    for (int i=0;i<q;++i)
    {
        F>>x;
        for (int j=0;j<5;++j)
            while ( x % v[j] == 0 )
                x /= v[j];
        if ( x == 1 )
            ++out;
    }
    G<<out<<'\n';
}