Cod sursa(job #2206960)

Utilizator Alex_BubBuburuzan Alexandru Alex_Bub Data 24 mai 2018 17:08:01
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");

const int NMAX = 276997;

int v[5] = {2, 3, 5, 7, 11};

int main()
{
    int k, nr = 0;

    string s;

    for(int i = 0; i < NMAX; i++) getline(fin, s);

    fin >> k;

    fin.get();

    while(k--) {
        getline(fin, s);

        long long x = 0;

        for(string :: iterator it = s.begin(); it < s.end(); it++)
                x = x * 10 + (*it - '0');

        for(int i : v) {
            while(!(x % i)) x /= i;
        }

        if(x == 1) nr++;
    }

    cout << (4 & (-4));
    fout << nr;

    fin.close();
    fout.close();

    return 0;
}