Cod sursa(job #1083188)

Utilizator buzu.tudor67Tudor Buzu buzu.tudor67 Data 15 ianuarie 2014 18:34:17
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include<fstream>
#include<unordered_set>
using namespace std;
ifstream fi("dtcsu.in");
ofstream fo("dtcsu.out");

unordered_set <long long> hash;
int i,n,s=0;
long long x;

int main(){
    for(i=1;i<=276997;i++)
      {
       fi>>x;
       //inserez numerele impare
       if(x&1) hash.insert(x);
      }
                          
    fi>>n;
    for(i=1;i<=n;i++)
      {
       fi>>x;
       if(x!=0){
                while(!(x&1)) x>>=1;
                if(hash.find(x)!=hash.end()) s++;
               }
      }
    
    fo<<s;
    
    fi.close();
    fo.close();
    return 0;
}