Pagini recente » Cod sursa (job #3242480) | Cod sursa (job #945697) | Cod sursa (job #784515) | Cod sursa (job #1093730) | Cod sursa (job #38300)
Cod sursa(job #38300)
#include <stdio.h>
int main ()
{
int t,n,i,x,xa,A[3];
freopen ( "bowling.in" , "r" , stdin );
freopen ( "bowling.out" , "w" , stdout );
scanf ( "%d\n" , &t );
for ( t ; t ; t-- ) {
scanf ( "%d" , &n );
A[0]=A[1]=A[2]=0;xa=0;
for ( i=0 ; i<n ; i++ ) {
scanf ( "%d" , &x );
if (i==0) A[2]=x;
if (i==1) A[2]=x|A[1];
if (i>=2)
if (x&&xa) A[2]=A[1]||A[0]; else
if (x) A[2]=!A[1]; else A[i]=A[1];
xa=x;
A[0]=A[1];A[1]=A[2];A[2]=0;
}
if (A[1]) printf ( "Nargy\n" ); else printf ("Fumeanu\n") ;
}
fclose ( stdin );
fclose ( stdout );
return 0;
}