Pagini recente » Cod sursa (job #586586) | Cod sursa (job #1542025) | Cod sursa (job #2580917) | Cod sursa (job #1441218) | Cod sursa (job #1265513)
#include <fstream>
#include <algorithm>
#define buflen 10000
using namespace std;
int answer;
int n;
long long shmen[50005];
int shmenPos;
char buf[buflen];
int bufpos = buflen;
ifstream f("dtcsu.in");
ofstream g("dtcsu.out");
char getch()
{
if (bufpos >= buflen)
{
f.read(buf,buflen);
bufpos = 0;
}
return buf[bufpos++];
}
inline bool isNumber(char a)
{
return '0' <= a && a <= '9';
}
long long BISRead()
{
long long aux = 0;
char ct = getch();
while (!isNumber(ct)) ct = getch();
while (isNumber(ct))
{
aux = 10 * aux + ct - '0';
ct = getch();
}
return aux;
}
int main()
{
for (int i=1;i <= 276997;i++)
{
int aux = BISRead();
if (aux&1) shmen[shmenPos++] = aux;
}
sort(shmen,shmen+shmenPos);
n = BISRead();
for (int i=1;i<=n;i++)
{
long long ct = BISRead();
while (!(ct&1)) ct >>= 1;
long long* p = lower_bound(shmen,shmen+shmenPos,ct);
if (ct == *p) answer++;
}
g << answer;
return 0;
}