Cod sursa(job #1156126)

Utilizator alevasluialeHuhurez Marius alevasluiale Data 27 martie 2014 14:07:22
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
char c[20];
int o[4]={2,5,7,11};
int main()
{
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    int n,i,sol=0,j;
    long long q;
    for(i=0;i<276997;i++)
    {
        gets(c);
    }
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
       gets(c);
        q=0;
        char *p=c;
        while (*p>='0' && *p<='9') q=q*10+*p-'0',++p;

        for(j=0;j<4;j++) while(q%o[j]==0) q/=o[j];
        if(q==1) sol++;
    }
    printf("%d",sol);
}