Cod sursa(job #1032232)

Utilizator MihaiBunBunget Mihai MihaiBun Data 15 noiembrie 2013 19:06:35
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.52 kb
#include <cstdio>

using namespace std;
long i,q,nr,y;
long x;
int main()
{
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    for (i=1;i<=276997;i++)
    {
      scanf("%ld\n",&y);
    };
    scanf("%ld",&q);
    nr=0;
    for (i=1;i<=q;i++)
    {
       scanf("%ld",&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++;
    };
    printf("%ld",nr);
    return 0;
}