Cod sursa(job #1037066)

Utilizator test9cosmin Macovei test9 Data 19 noiembrie 2013 20:49:02
Problema Dtcsu Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 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");
long long x,q,nr,n=276997;
int main()
{
    while(n--)
    {
        f>>x;
        if(x%2LL)
           G.insert(x);
    }
    f>>q;
    while(q--)
    {
        f>>x;
        if(x%2LL==0LL && x&(-x))
            x=x/(x&(-x));
        if(G.count(x))
            nr++;
    }
    g<<nr<<'\n';
    g.close();
    return 0;
}