Cod sursa(job #1105720)

Utilizator MihaiBunBunget Mihai MihaiBun Data 11 februarie 2014 23:59:08
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <cstdio>
#include <string.h>
using namespace std;

int q,nr,i;
long long x,y;
char s[22];
int main()
{
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    for (i=1;i<=276997;i++)
    {
      fgets(s,22,stdin);
    };
    scanf("%d",&q);
    nr=0;
    for (i=1;i<=q;i++)
    {
       scanf("%lld",&x);

       while (x%10==0)x=x/10;
       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("%d",nr);
    return 0;
}