Cod sursa(job #1038522)

Utilizator deneoAdrian Craciun deneo Data 21 noiembrie 2013 17:57:17
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <fstream>
#include <unordered_set>
using namespace std;

unordered_set <long long> s;

const int dim = 276997;

ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");

int main() {
    for (int i = 1; i <= dim; ++i) {
        long long a; fin >> a;
        if (a % 2 != 0)
            s.insert(a);
    }

    int q, rez = 0; fin >> q;

    for (int i = 1; i <= q; ++i) {
        long long a; fin >> a;
        while (!(a ^ 1)) a >>= 1;
        if (s.find(a) != s.end()) ++rez;
    }

    fout << rez;
    return 0;
}