Cod sursa(job #2541801)

Utilizator AlexandruGabrielAliciuc Alexandru AlexandruGabriel Data 8 februarie 2020 22:00:24
Problema Jocul NIM Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin ("nim.in");
ofstream fout ("nim.out");

int t, n, s;

int main()
{
    fin >> t;
    while (t--)
    {
        int n;
        fin >> n;

        for (int i = 1; i <= n; i++)
        {
            int x;
            fin >> x;

            s ^= x;
        }

        if (s)
            fout << "DA\n";
        else
            fout << "NU\n";
    }
    return 0;
}