Cod sursa(job #1038506)

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

unordered_set <long long> s;

const int dim = 276997;

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

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

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

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

    fout << rez;
    return 0;
}