Cod sursa(job #1917701)

Utilizator ionanghelinaIonut Anghelina ionanghelina Data 9 martie 2017 12:49:44
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include<bits/stdc++.h>
using namespace std;
ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");
multiset<long long> hash;
int main()
{
    for(int i=1;i<=276997;i++)
    {
        long long x;
        fin>>x;
        if((x&1)) hash.insert(x);
    }
    int q;
    int sol=0;
    fin>>q;
    for(int i=1;i<=q;i++)
    {
        long long x;
        fin>>x;
        while(x && !(x&1)) x>>=1LL;
        if(*hash.find(x)==x) sol++;
    }
    fout<<sol;
    return 0;
}