Cod sursa(job #1868471)
Utilizator | Data | 4 februarie 2017 22:56:02 | |
---|---|---|---|
Problema | Dtcsu | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <unordered_set>
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("dtcsu.in");
ofstream out("dtcsu.out");
const int numnr = 276997;
unordered_set <long long> gasit;
int main()
{
for(int i = 1; i <= numnr; i++)
{
long long x;
in >> x;
if(x % 2 == 1)
gasit.insert(x);
}
int q;
in >> q;
int nr = 0;
for(int i = 1; i <= q; i++)
{
long long x;
in >> x;
while(x > 0 && x % 2 == 0)
x = x >> 2;
if(gasit.find(x) != gasit.end())
nr++;
}
out << nr << "\n";
return 0;
}