Cod sursa(job #2725203)

Utilizator felixiPuscasu Felix felixi Data 18 martie 2021 15:41:19
Problema Dtcsu Scor 20
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.84 kb
#include <bits/stdc++.h>

using namespace std;

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

const int GIVEN = 276997;

int main()
{
    for (int i = 0; i < GIVEN; ++i) {
        static long long x;
        in >> x;
    }
    int q;
    in >> q;
    int ans = 0;
    while (q--) {
        long long x;
        in >> x;
        while (x % 2 == 0)
            x >>= 1;
        while (x % 9 == 0)
            x /= 9;
        if (x % 3 == 0)
            x /= 3;
        
        while (x % 25 == 0)
            x /= 25;
        if (x % 5 == 0)
            x /= 5;

        while (x % 49 == 0)
            x /= 49;
        if (x % 7 == 0)
            x /= 7;

        while (x % 121 == 0)
            x /= 121;
        if (x % 11 == 0)
            x /= 11;

        ans += (x == 1);

    }
    out << ans << '\n';
}