Cod sursa(job #1502790)

Utilizator Ionut228Ionut Calofir Ionut228 Data 14 octombrie 2015 23:58:20
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <fstream>
#include <unordered_map>

using namespace std;

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

int Q, lg, sol;
long long N;
unordered_map<long long, bool> H;

int main()
{
    long long x;
    for (int i = 1; i <= 276997; ++i)
    {
        fin >> x;

        if (x & 1)
            H.insert(make_pair(x, true));
    }
    fin >> Q;
    while (Q--)
    {
        fin >> N;

        if (N & -N)
            N /= (N & -N);

        if (H.find(N)->second)
            ++sol;
    }

    fout << sol << '\n';

    fin.close();
    fout.close();
    return 0;
}