Cod sursa(job #2021780)

Utilizator adimiclaus15Miclaus Adrian Stefan adimiclaus15 Data 14 septembrie 2017 18:07:43
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("dtcsu.in");
ofstream g("dtcsu.out");
long long q,x,i,y,nr;
int main()
{
    for(i=1;i<=276997;i++)
    {
        f>>y;
    }
    f>>q;
    for(i=1;i<=q;i++)
    {
        f>>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++;
        }
    }
    g<<nr;
    return 0;
}