Cod sursa(job #2876672)

Utilizator BAlexandruBorgovan Alexandru BAlexandru Data 23 martie 2022 13:34:37
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.43 kb
#include <fstream>

using namespace std;

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

int t, n;

int main()
{
    f >> t;

    while (t--)
    {
        f >> n;

        int s = 0;
        for (int i = 1; i <= n; i++)
        {
            int x; f >> x;
            s = s ^ x;
        }

        if (s > 0)
            g << "DA" << "\n";
        else
            g << "NU" << "\n";
    }

    return 0;
}