Cod sursa(job #1016366)

Utilizator VmanDuta Vlad Vman Data 26 octombrie 2013 09:28:01
Problema Dtcsu Scor Ascuns
Compilator cpp Status done
Runda Marime 0.57 kb
#include <cstdio>

long long X;
int Q;

int main() {
    freopen("dtcsu.in","r", stdin);
    freopen("dtcsu.out", "w", stdout);
    
    for (int i=0; i<276997; ++i)
        scanf("%lld", &X);
    
    scanf("%d", &Q);
    int total = 0;
    for (int i=0; i<Q; ++i) {
        scanf("%lld", &X);
        long long XX = X;
        if (X == 0) continue;
        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) ++total;
    }
    printf("%d\n", total);
    
    return 0;
}