Pagini recente » Cod sursa (job #829446) | Cod sursa (job #1164300) | Cod sursa (job #1037415) | Cod sursa (job #897221) | Cod sursa (job #1048657)
#include<fstream>
#include<cstdio>
#include<bitset>
using namespace std;
int sol,i,j,ok;
long long q,x;
const int MOD[5]={666013,1000003,826663,797593,959473};
bitset<1000013>h[5];
const int D=100000;
char buf[D];
int poz=D+3;
inline long long ianr()
{
unsigned long long nr=0;
while((buf[poz]<'0'||buf[poz]>'9')&&buf[poz]!='-')
if(++poz>=D)
fread(buf,D,1,stdin),poz=0;
int semn=1;
if(buf[poz]=='-')
++poz,semn=-1;
while('0'<=buf[poz]&&buf[poz]<='9')
{
nr=nr*10+buf[poz]-'0';
if(++poz>=D)
fread(buf,D,1,stdin),poz=0;
}
return nr*semn;
}
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
for(i=1;i<=276997;++i)
{
x=ianr();
for(j=0;j<=4;++j)
h[j][x%MOD[j]]=1;
}
q=ianr();
for(i=1;i<=q;++i)
{
x=ianr();
ok=1;
for(j=0;j<=4&&ok;++j)
if(h[j][x%MOD[j]]==1)
ok=0;
if(ok)
{
x=x&(-x);
for(;(x/15)*15==x;x/=15);
for(;(x/3)*3==x;x/=3);
for(;(x/5)*5==x;x/=5);
for(;(x/7)*7==x;x/=7);
for(;(x/11)*11==x;x/=11);
if(x==1)
++sol;
}
}
printf("%d\n",sol);
return 0;
}