Cod sursa(job #1502806)

Utilizator Ionut228Ionut Calofir Ionut228 Data 15 octombrie 2015 00:08:08
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <fstream>
#include <unordered_set>

using namespace std;

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

int Q, lg, sol;
long long N;
unordered_set<long long> H;

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

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

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

        if (H.find(N) != H.end())
            ++sol;
    }

    fout << sol << '\n';

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