Cod sursa(job #1037050)

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