Pagini recente » Cod sursa (job #1617087) | Monitorul de evaluare | Cod sursa (job #1001844) | Cod sursa (job #2912997) | Cod sursa (job #2018069)
//
// A.cpp
// Bowling - Infoarena
//
// Created by Vlad Turcuman on 03/09/2017.
// Copyright © 2017 Vlad Turcuman. All rights reserved.
//
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
#include <cmath>
#include <map>
#define pii pair<int,int>
#define fs first
#define sc second
#define NMax 50010
using namespace std;
ifstream fin("bowling.in");
ofstream fout("bowling.out");
int grd[NMax];
bool mex[NMax][3];
int main()
{
for(int i=0;i<=50000;i++)
{
if(mex[i][2] == 0)
grd[i] = 2;
if(mex[i][1] == 0)
grd[i] = 1;
if(mex[i][0] == 0)
grd[i] = 0;
mex[i+1][grd[i]] = 1;
mex[i+2][grd[i]] = 1;
}
int n,k;
fin>>k;
while(k--)
{
fin>>n;
int s = 0;
int st = 1;
int a;
for(int i=1;i<=n;i++)
{
fin>>a;
if(a == 0)
{
if(i-st)
s = s ^ grd[(i-st)];
st = i+1;
}
}
if(n+1-st)
s = s ^ grd[(n+1-st)];
if(s)
fout<<"Nargy"<<'\n';
else
fout<<"Fumeanu"<<'\n';
}
return 0;
}