Cod sursa(job #1030802)

Utilizator dragangabrielDragan Andrei Gabriel dragangabriel Data 15 noiembrie 2013 16:58:00
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.56 kb
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long x;
int i;
char s[20];
int main()
{
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    for (i=1;i<=276997;i++) gets(s);
    int n;
    scanf("%d",&n);
    int rez=0;
    for (i=1;i<=n;i++)
    {
        scanf("%lld",&x);
        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) rez++;
    }
    printf("%d\n",rez);
    return 0;
}