Cod sursa(job #1031069)

Utilizator mazaandreiAndrei Mazareanu mazaandrei Data 15 noiembrie 2013 17:23:29
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.76 kb
#include <cstdio>
#include <map>
#define DIM 10000
using namespace std;
map <long long, bool> m;
long long x,q,nr;
char buff[DIM];
int poz;
//ifstream in("dtcsu.in"); ofstream out("dtcsu.out");
void cit(long long &numar){
     numar=0;
     while(buff[poz]<'0' || buff[poz]>'9')
        if(++poz==DIM)
            fread(buff,1,DIM,stdin),poz=0;

     while(buff[poz]>='0' && buff[poz]<='9'){
         numar=numar*10+buff[poz]-'0';
         if(++poz==DIM)
            fread(buff,1,DIM,stdin),poz=0;
     }
}
int main(){
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    for(int i=1;i<=276997;++i){ cit(x); m[x]=true;}
    cit(q);
    for(int i=1;i<=q;++i) { cit(x); if(m[x])++nr;}
    printf("%lld\n", nr);
    return 0;
}