Cod sursa(job #1065118)

Utilizator qwerty1Thomas Suditu qwerty1 Data 22 decembrie 2013 19:54:24
Problema Dtcsu Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <fstream>
#include <unordered_set>

using namespace std;
unordered_set<long long> S;
int main()
{
    ifstream f("dtcsu.in");
    int i,Q, sol = 0;
    long long x;
    for(i = 1; i<= 276997;++i)
    {
        f >> x;
        if(x&1)
            S.insert(x);
    }
    for(f >> Q; Q;--Q)
    {
        f >> x;
        if(x && S.find(x/(x&(-x)))!=S.end())
            ++sol;
    }
    ofstream g("dtcsu.out");
    g<<sol<<"\n";
    g.close();
    return 0;
}