Pagini recente » Cod sursa (job #3233225) | Cod sursa (job #51815) | Cod sursa (job #1096319) | Cod sursa (job #1903575) | Cod sursa (job #37835)
Cod sursa(job #37835)
#include <fstream.h>
ifstream fin("bowling.in");
ofstream fout("bowling.out");
long t, n, nr, k, i, j, x, y, aux1;
int main()
{
fin>>t;
for(i=1; i<=t; i++)
{
fin>>n;
aux1=0;
x=0;
y=0;
for(j=1; j<=n; j++)
{
fin>>nr;
k=0;
if(nr)
{
while(nr && j<=n)
{
k++;
j++;
if(j>n)
break;
fin>>nr;
}
if(k==1)
aux1++;
else
{
if(k%4==1)
{
aux1++;
}
else if(k%4==2)
{
if(x==1)
{
x=0;
y=0;
}
else
x=1;
}
else if(k%4==3)
{
aux1++;
if(x==1)
{
x=0;
y=0;
}
else
x=1;
}
}
}
}
if(aux1%2==1)
{
if(x==1)
{
x=0;
y=0;
}
else
x=1;
}
if(x==y)
fout<<"Fumeanu\n";
else
fout<<"Nargy\n";
}
return 0;
}