Cod sursa(job #229347)

Utilizator ooctavTuchila Octavian ooctav Data 9 decembrie 2008 22:17:45
Problema Bowling Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 kb
// bowlig.cpp : Defines the entry point for the console application.
//

#include <stdio.h>

int main()
{
	int t,a,b,i,j,d=0;
	bool n[50004];
	FILE *f1,*f2;
	f1=fopen("bowling.in","r");
	f2=fopen("bowling.out","w");
	fscanf(f1,"%d",&t);
	for(i=1;i<=t;i++)
	{
		fscanf(f1,"%d",&a);
		for(j=1;j<=a+2;j++)
		{
			n[j]=0;
		}
		for(j=1;j<=a;j++)
		{
			fscanf(f1,"%d",&b);
			n[j]=b;
		}
		for(j=1;j<=a;j++)
		{
			if(n[j]==1)
			{
				n[j]=0;
				n[j+1]=0;
				d++;
			}
		}
		if(d%2==1)	fprintf(f2,"Nargy\n");
		else	fprintf(f2,"Fumeanu\n");
	}
	fclose(f1);
	fclose(f2);

			
	return 0;
}