Pagini recente » Cod sursa (job #1332509) | Cod sursa (job #311476) | Cod sursa (job #2414475) | Cod sursa (job #194754) | Cod sursa (job #1017498)
Utilizator |
Duta Vlad Vman |
Data |
27 octombrie 2013 20:15:45 |
Problema |
Dtcsu |
Scor |
Ascuns |
Compilator |
cpp |
Status |
done |
Runda |
|
Marime |
1.05 kb |
#include <cstdio>
#define ll long long
char B[524288];
int main() {
int Q;
ll X;
const ll F = 4194303LL;
char S[20];
int total = 0;
freopen("dtcsu.in","r", stdin);
freopen("dtcsu.out", "w", stdout);
int i;
static int b;
for (i=0; i<276997; ++i) {
scanf("%lld", &X);
/*
b = ((X>>24) & F);
B[b>>3] |= (1<<(b & 7));*/
}
scanf("%d\n", &Q);
while (Q--) {
static int j;
fgets(S,20,stdin);
X = 0LL;
for (j=0; S[j]!='\n'; ++j)
X = X*10+S[j]-'0';
if (!X) continue;
static ll a;
/*
b = ((X>>24) & F);
if (!(B[b>>3] & (1<<(b & 7)))) continue;*/
X /= (X&(-X));
while ((a=X/15)*15==X) X = a;
while (((a=X/3)<<1)+a==X) X = a;
while (((a=X/5)<<2)+a==X) X = a;
while ((a=X/7)*7==X) X = a;
while ((a=X/11)*11==X) X = a;
total += (X == 1LL);
}
printf("%d\n", total);
return 0;
}