Cod sursa(job #1037006)

Utilizator test9cosmin Macovei test9 Data 19 noiembrie 2013 20:14:12
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <iostream>
#include <fstream>
#include <tr1/unordered_set>
using namespace std;
tr1::unordered_set <unsigned long long> G;
ifstream f("dtcsu.in");
ofstream g("dtcsu.out");
int q,nr,n=276997;
unsigned long long x;
int main()
{
    while(n--)
    {
        f>>x;
        if(x%2)
           G.insert(x);
    }
    f>>q;
    while(q--)
    {
        f>>x;
        if(x%2==0)
            x=x/(x&(-x));
        if(G.count(x))
            nr++;
    }
    g<<nr<<'\n';
    g.close();
    return 0;
}