Cod sursa(job #1031202)

Utilizator chiriacandrei25Chiriac Andrei chiriacandrei25 Data 15 noiembrie 2013 17:35:05
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.68 kb
#include <fstream>

using namespace std;

char sir[30005];

inline bool Bun(long long X)
{
    if(X==0)
        return true;
    while(X%2==0)
        X/=2;
    while(X%3==0)
        X/=3;
    while(X%5==0)
        X/=5;
    while(X%7==0)
        X/=7;
    while(X%11==0)
        X/=11;
    if(X==1)
        return true;
}

int main()
{
    int i,sol=0,N;
    long long X;
    ifstream fin("dtcsu.in");
    for(i=1;i<=276997;i++)
        fin.getline(sir,30000);
    fin>>N;
    for(i=1;i<=N;i++)
    {
        fin>>X;
        if(Bun(X))
            sol++;
    }
    ofstream fout("dtcsu.out");
    fout<<sol<<"\n";
    fout.close();
    return 0;
}