Pagini recente » Cod sursa (job #1859241) | Cod sursa (job #351863) | Cod sursa (job #976802) | Cod sursa (job #2615199) | Cod sursa (job #2026811)
#include <fstream>
#include <bitset>
#define lg 276997
using namespace std;
ifstream fi ("dtcsu.in");
ofstream fo ("dtcsu.out");
bitset<10000> hsh[3];
int i,h,x,q,sol;
int main()
{
for (i=1;i<=lg;i++)
{
fi>>x;
hsh[0][(5*x+(x%143)^2)%9973]=1;
hsh[1][(8*x+(x%253)^2)%9967]=1;
hsh[2][(3*x+(x%1003)^2)%9601]=1;
}
fi>>q;
for (i=1;i<=q;i++)
{
fi>>x;
bool ok=true;
for (h=0;h<3;h++)
if (hsh[h][x]==0) ok=false;
if (ok) sol++;
}
fo<<sol;
return 0;
}