Cod sursa(job #1195043)

Utilizator AndreiBarbutaAndrei Barbuta AndreiBarbuta Data 5 iunie 2014 22:10:53
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <cstdio>
#include <unordered_set>

using namespace std;

unordered_set<long long int>h;

int main()
{
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    long long int x,cnt=0,n;
    for(register int i=1;i<=276997;i++){
        scanf("%lld",&x);
        if(x&1)h.insert(x);
    }
    scanf("%d",&n);
    for(register int i=1;i<=n;i++){
        if(x&(-x))x/=x&(-x);
        if(x and h.find(x)!=h.end())cnt++;
    }
    printf("%d",cnt);
    return 0;
}