Pagini recente » Cod sursa (job #914265) | Cod sursa (job #1025661) | Cod sursa (job #1889091) | Cod sursa (job #2051030) | Cod sursa (job #1263404)
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define V 276997
#define mod 10000
#define maxBuf 10000
long Q,x,i;
vector<long> H[mod];
char Buff[maxBuf];
long pos,Ans;
inline bool isDigit(char c){
return c >= '0' && c <= '9';
}
long getLong(){
while(!isDigit(Buff[pos])){
pos++;
if(pos == maxBuf){
pos = 0;
fread(Buff,1,maxBuf,stdin);
}
}
long Ans=0;
while(isDigit(Buff[pos])){
Ans = Ans*10 + Buff[pos++] - '0';
if(pos == maxBuf){
pos = 0;
fread(Buff,1,maxBuf,stdin);
}
}
return Ans;
}
bool isGood(long sour,long x){
for(long i=0;i<H[sour].size();i++)
if(H[sour][i] == x) return true;
return false;
}
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
fread(Buff,1,maxBuf,stdin);
for(i=1;i<=V;i++){
x = getLong();
H[x%mod].push_back(x);
}
Q = getLong();
for(;Q;Q--){
x = getLong();
long dest = x % mod;
//if(isGood(dest,x)) Ans++;
}
printf("%ld",Ans);
return 0;
}