Pagini recente » Cod sursa (job #2208288) | Cod sursa (job #398467) | Cod sursa (job #892114) | Cod sursa (job #1904743) | Cod sursa (job #1802674)
#include<fstream>
using namespace std;
ifstream in("dtcsu.in");
ofstream out("dtcsu.out");
#define MOD 276997
bool bloom_filter[276997];
int main()
{
unsigned long long x;
for (int i = 1; i <= 276997; ++i)
{
in >> x;
bloom_filter[x % MOD] = 1;
bloom_filter[(x+27) % MOD] = 1;
}
int Q,nr=0;
in >> Q;
for (int i = 1; i <= Q; ++i)
{
in >> x;
if (bloom_filter[x % MOD] & bloom_filter[(x + 27) % MOD])
{
nr += (x == 1);
}
}
out << nr;
return 0;
}