Cod sursa(job #1032274)

Utilizator rares96cheseliRares Cheseli rares96cheseli Data 15 noiembrie 2013 19:10:09
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.55 kb
#include <fstream>
#include <algorithm>
using namespace std;
#define Nmax 300000
using namespace std;

ifstream f("dtcsu.in");
ofstream g("dtcsu.out");

int Q,sol;
long long N,x;

int main()
{
    for(int i=1;i<=276997;++i)f>>x;
    f>>Q;
    for(int i=1;i<=Q;++i)
    {
        long long N;
        f>>N;
        while(N%2==0)N/=2;
        while(N%3==0)N/=3;
        while(N%5==0)N/=5;
        while(N%7==0)N/=7;
        while(N%11==0)N/=11;
        if(N==1)++sol;
    }
    g<<sol<<'\n';
    f.close();g.close();
    return 0;
}