Pagini recente » Cod sursa (job #2210907) | Cod sursa (job #2516229) | Cod sursa (job #2956926) | Cod sursa (job #2418242) | Cod sursa (job #1092933)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
ifstream fin("bowling.in");
ofstream fout("bowling.out");
int T, N, S, V[105];
vector <bool> uz(105);
int Period(int x)
{
return x < 72 ? x : (x % 12) + 72;
}
void Prec_SG()
{
//V[1] = 1;
for(int i = 1; i <= 83; i++)
{
for(int j = 1, lim = (i >> j) + 1; j <= lim; j++)
uz[V[i - j] ^ V[i - (i - j) - 1]] = uz[V[i - j - 1] ^ V[i - (i - j) - 1]] = true;
for(int k = 0; k <= 10; k++)
if(!uz[k])
{
V[i] = k;
break;
}
//cout<<V[i]<<endl;
uz.assign(12, 0);
}
}
int main()
{
fin >> T;
Prec_SG();
while(T--)
{
fin >> N; int lg = 0; S = 0;
for(int i = 1; i <= N; i++)
{
int x; fin >> x;
if(x) lg++;
else
if(lg) S ^= V[Period(lg)], lg = 0;
}
if(lg) S ^= V[Period(lg)];
if(S) fout << "Nargy";
else fout << "Fumeanu";
fout << '\n';
}
return 0;
}