Cod sursa(job #1502799)

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

using namespace std;

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

int Q, lg, sol;
long long N;
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) != H.end())
            ++sol;
    }

    fout << sol << '\n';

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