Pagini recente » Cod sursa (job #1375668) | Cod sursa (job #342791) | Cod sursa (job #2747837) | Cod sursa (job #1046754) | Cod sursa (job #1048658)
#include<fstream>
#include<cstdio>
#include<bitset>
using namespace std;
int q,sol,i,j,ok;
long long 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;
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;
}
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=(int)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;
}