Pagini recente » Cod sursa (job #212473) | Cod sursa (job #3272296) | Cod sursa (job #480059) | Cod sursa (job #258555) | Cod sursa (job #1031960)
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int p[1000001];
int main()
{
long n,q,i,x,rez=0,sf=0,c,nr,poz,j,ok;
char a[1000];
FILE *f,*g;
f=fopen("dtcsu.in","r");
g=fopen("dtcsu.out","w");
for (i=1; i<=276997; i++)
//for (i=1; i<=3; i++)
{
if (i>50000) fscanf(f,"%s",&a);
else
{
fscanf(f,"%d",&x);
nr=0;
sf++;
p[sf]=x;
}
}
fscanf(f,"%d",&q);
for (i=1; i<=q; i++)
{
fscanf(f,"%d",&x);
poz=1;
ok=0;
while (poz<=sf && ok==0)
{
if (p[poz]==x)
ok=1;
poz++;
}
if (ok) rez++;
}
fprintf(g,"%d",rez);
return 0;
}