Cod sursa(job #1014797)

Utilizator leontinLeontin leontin Data 23 octombrie 2013 13:07:39
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include<iostream>
#include<fstream>
using namespace std;
int main()
{int n,i,x,y,j,ok,c=0,v[1000];
	
	ifstream f("hashuri.in");
ofstream g("hashuri.out");
f>>n;
for(i=1;i<=n;i++)
{
	f>>x>>y;
	if(x==1)
	{
	c++;
	v[c]=y;}
	else
		if(x==2)
			{
		for(j=1;j<=c;j++)
			if(v[j]==y)
				v[j]=0;}
			else
				if(x==3)
				{
				ok=0;
				for(j=1;j<=c;j++)
					if(v[j]==y)
						ok=1;
					g<<ok<<"\n";}
			
}
f.close();
g.close();
return 0;}