Cod sursa(job #2605646)

Utilizator Alex_tz307Lorintz Alexandru Alex_tz307 Data 25 aprilie 2020 16:35:09
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.44 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f ("nim.in");
ofstream g ("nim.out");

int t, n, a, xorsum;

int main()
{
    f >> t;
    while(t--)
    {
        f >> n;
        xorsum = 0;
        for (int i = 1; i <= n; ++i)
        {
            f >> a;
            xorsum = xorsum ^ a;
        }

        if(xorsum) g << "DA\n";
        else g << "NU\n";
    }
    f.close();
    g.close();
    return 0;
}