Cod sursa(job #1561599)

Utilizator SilviuIIon Silviu SilviuI Data 4 ianuarie 2016 12:16:11
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <stdio.h>
#include <bitset>
#define lmax 276997
#define mod1 666013
#define mod2 123451
#define mod3 756891
#define mod4 564131
#define mod5 458913

using namespace std;
typedef long long int ll;

int n,nr;
ll x;
bitset <mod1+10> uhash;

int main()
{
	freopen("dtcsu.in","r",stdin);
	freopen("dtcsu.out","w",stdout);
	for (int i=1;i<=lmax;i++) {
		scanf("%lld",&x); 
		uhash[x%mod1]=1; uhash[x%mod2]=1; uhash[x%mod3]=1; 
		uhash[x%mod4]=1; uhash[x%mod5]=1;
	}
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%lld",&x);
		if (uhash[x%mod1]==1 && uhash[x%mod2]==1 && uhash[x%mod3]==1
		    && uhash[x%mod4]==1 && uhash[x%mod5]==1) nr++;
	}
	printf("%d",nr);
	return 0;
}