Cod sursa(job #1132474)

Utilizator oprea1si2si3Oprea Sebastian oprea1si2si3 Data 3 martie 2014 14:44:16
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.72 kb
#include<fstream>
using namespace std;

long long x;
int N,sol;
char aux[300];

int main() {

    ifstream in("dtcsu.in");
    ofstream out("dtcsu.out");
    int i;
    in.getline(aux,300);
    in>>N;
    for(i=1;i<=N;i++) {
        in>>x;
        if(x%2==0)
            while(x%2==0)
                x=x/2;

        if(x%3==0)
            while(x%3==0)
                x=x/3;
        if(x%5==0)
            while(x%5==0)
                x=x/5;
        if(x%7==0)
            while(x%7==0)
                x=x/7;
        if(x%11==0)
            while(x%11==0)
                x=x/11;
        if(x==1)
            sol++;
    }
    out<<sol<<'\n';
    in.close();
    out.close();
    return 0;

}