Cod sursa(job #37940)

Utilizator sima_cotizoSima Cotizo sima_cotizo Data 25 martie 2007 13:07:45
Problema Bowling Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.71 kb
#include <cstdio>
#define FIN "bowling.in"
#define FOUT "bowling.out"
#define MAX 50000
#define FOR(l,h,i) for(i=l;i<h;++i)
#define tip long


const char *rasp[] = {
	"Nargy", "Fumeanu"
};
long T, n;
tip A[MAX];

int bulaneala() {
	long last=-1, i;
	long lung = 0;
     A[n] = 0;
	FOR(0,n+1,i) {
		if ( A[i] == 0 )  {
			if ( lung!=0 && i-last-1!=lung && i-last-1>0)
				return 0;
          
			if ( lung == 0 )
				lung = i-last-1;
               last = i;
		}
	}
	return 1;
}

int main() {
	long i;
	freopen(FIN, "r", stdin);
	freopen(FOUT, "w", stdout);
	scanf("%ld", &T);
	while (T--) {
		scanf("%ld", &n);
		FOR(0,n,i)
			scanf("%ld",A+i);
		printf("%s\n", rasp[ bulaneala() ]);
	}
	fclose(stdin);fclose(stdout);
	return 0;
}