Pagini recente » Cod sursa (job #2118771) | Cod sursa (job #480408) | Cod sursa (job #599126) | Cod sursa (job #2320381) | Cod sursa (job #1050062)
#include<cstdio>
#include<vector>
#include<ctype.h>
using namespace std;
const int dim = 10073;
const int BUF_SIZE = 4096;
vector<long long> h[dim + 2];
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(long long val) {
int i, key = val % dim;
for(i=0; i<(int)h[key].size(); ++i)
if(h[key][i] == 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)
h[val % dim].push_back(val);
}
n = read(f);
while(n--) {
val = read(f);
val /= (val & -val);
ans += find(val);
}
fprintf(g,"%lld",ans);
fclose(f);
fclose(g);
return 0;
}