Pagini recente » Cod sursa (job #1634780) | Cod sursa (job #1511972) | Cod sursa (job #2188754) | Cod sursa (job #2631392) | Cod sursa (job #1696927)
#include <cstring>
#include <fstream>
#include <algorithm>
using namespace std;
int T, N;
int SP[1002];
bool ok[1002];
int main()
{
ifstream fin("bowling.in");
ofstream fout("bowling.out");
// ciclic din 12 in 12 (de la un moment dat)
for (int i = 1; i <= 1000; ++i)
{
memset(ok, 0, sizeof(ok));
for (int j = 0; j <= i - 1; ++j)
ok[SP[j] ^ SP[i - j - 1]] = true;
for (int j = 0; j <= i - 2; ++j)
ok[SP[j] ^ SP[i - j - 2]] = true;
for (int j = 0; ok[j]; ++j, ++SP[i]);
}
fin >> T;
for (int test = 1; test <= T; ++test)
{
fin >> N;
int now = 0, result = 0;
for (int i = 1, aux; i <= N; ++i)
{
fin >> aux;
if (aux == 0)
{
if (now != 0)
{
if (now >= 1000) now = 612 + now % 12;
result ^= SP[now];
}
now = 0;
}
if (aux == 1) ++now;
}
if (now != 0)
{
if (now >= 1000) now = 612 + now % 12;
result ^= SP[now];
}
if (result == 0) fout << "Fumeanu\n";
else fout << "Nargy\n";
}
fin.close();
fout.close();
}