Cod sursa(job #1031786)

Utilizator lorundlorund lorund Data 15 noiembrie 2013 18:25:08
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.66 kb
#define LINES 276997
#include <cstdio>


int main()
{
    freopen("dtcsu.in", "r", stdin);
    freopen("dtcsu.out", "w", stdout);

    register int Q, c=0;
    register long long N;
    char s[20];

    for (int i=0; i<LINES ; ++i){
            fgets(s,20,stdin);
    }

    scanf("%d", &Q);
    for (int i=0; i<Q; ++i){
        scanf("%lld", &N);

        while (!(N%2))
            N>>=1;
        while (!(N%3))
            N/=3;
        while (!(N%5))
            N/=5;
        while (!(N%7))
            N/=7;
        while (!(N%11))
            N/=11;
        if (N==1)
            ++c;
    }
    printf("%d", c);
    return 0;
}