Cod sursa(job #885156)

Utilizator darrenRares Buhai darren Data 21 februarie 2013 17:55:23
Problema Bowling Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.01 kb
#include <cstring>
#include <fstream>
#include <algorithm>
#include <vector>

using namespace std;

int T, N;
int A[50002], SP[50002];
bool ok[50002];
vector<int> V;

int main()
{
    ifstream fin("bowling.in");
    ofstream fout("bowling.out");

    /*for (int i = 1; i <= 50000; ++i)
    {
        memset(ok, 0, sizeof(ok));
        for (int j = 0; j <= ((i - 1) + 1) / 2; ++j)
            ok[SP[j] ^ SP[i - j - 1]] = true;
        for (int j = 0; ok[j]; ++j, ++SP[i]);

        if (i <= 100) fout << SP[i] << ' ';
    }
    fout << '\n';*/

    fin >> T;
    for (int test = 1; test <= T; ++test)
    {
        V.clear();

        fin >> N;

        int now = 0, result = 0;
        for (int i = 1; i <= N; ++i)
        {
            fin >> A[i];
            if (A[i] == 0 && now != 0) result ^= (now % 2);
            if (A[i] == 1) ++now;
        }

        if (result == 0) fout << "Fumenau\n";
        else             fout << "Nargy\n";
    }

    fin.close();
    fout.close();
}