Cod sursa(job #1032138)

Utilizator leontinLeontin leontin Data 15 noiembrie 2013 18:57:58
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.54 kb
#include <iostream>
#include<fstream>
using namespace std;
int main()
{
    ifstream f("dtcsu.in");
    ofstream g("dtcsu.out");
    long long x, i,q,nr=0;
    char s[20];
    for(i=1;i<=276997 ;i++)
    f>>s;
    f>>q;
    for(i=1;i<=q;i++)
    {
        f>>x;

        while(x%2==0)
        x=x/2;
        while(x%3==0)
        x=x/3;
        while(x%5==0)
        x=x/5;
        while(x%7==0)
        x=x/7;
        while(x%11==0)
        x=x/11;
        if(x==1)
        nr++;

    }
    g<<nr<<endl;
    return 0;
}