Mai intai trebuie sa te autentifici.
Cod sursa(job #1031866)
Utilizator | Data | 15 noiembrie 2013 18:31:47 | |
---|---|---|---|
Problema | Dtcsu | Scor | 0 |
Compilator | cpp | Status | done |
Runda | FMI No Stress 4 | Marime | 0.65 kb |
#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>100000) 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;
}