Cod sursa(job #607908)

Utilizator andreii1Ilie Andrei andreii1 Data 13 august 2011 18:59:11
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.42 kb
#include <stdio.h>
#define DIM 1000000
int x,y,N,i;
int a[DIM];

int main(){
	FILE *f = fopen("hashuri.in","r");
	FILE *g = fopen("hashuri.out","w");
	fscanf(f,"%d",&N);
	for (i=1;i<=N;i++)
	{
		fscanf(f,"%d" "%d",&y,&x);
		if (y==1) a[x]=1;
		else
		if (y==2) a[x]=0;
		else
		if (y==3){
			if (a[x]==1) fprintf(g,"%d\n",1);
			else
			fprintf(g,"%d\n",0);
			}
	}


	fclose(f);
	fclose(g);
	return 0;
}