Pagini recente » Cod sursa (job #1043800) | Cod sursa (job #880655) | Cod sursa (job #3129804) | Cod sursa (job #556990) | Cod sursa (job #1050052)
#include<cstdio>
#include<vector>
#include<ctype.h>
using namespace std;
const int dim = 10073;
const int BUF_SIZE = 4096;
vector<long long> h[dim];
char buf[BUF_SIZE];
long long ans, n = 276997LL;
int pos = 0;
inline char getChar(FILE *f) {
if (pos == BUF_SIZE) {
fread(buf, 1, BUF_SIZE, f);
pos = 0;
}
return buf[pos++];
}
inline long long read(FILE *f) {
long long result = 0LL;
char c;
do {
c = getChar(f);
} while (!isdigit(c));
do {
result = 10 * result + c - '0';
c = getChar(f);
} while (isdigit(c));
return result;
}
int find(int val) {
int key = val % dim;
for(auto it = h[key].begin(); it!=h[key].end(); ++it)
if(*it == val)
return 1;
return 0;
}
int main() {
FILE *f = fopen("dtcsu.in", "r");
FILE *g = fopen("dtcsu.out", "w");
long long val;
while(n--) {
val = read(f);
if(val % 2 == 1)
h[val % dim].push_back(val);
}
n = read(f);
while(n--) {
val = read(f);
val /= (val & -val);
ans += find(val);
}
fprintf(g,"%lld\n",ans);
fclose(f);
fclose(g);
return 0;
}