Cod sursa(job #2860800)

Utilizator andreiiorgulescuandrei iorgulescu andreiiorgulescu Data 3 martie 2022 09:28:15
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 kb
#include <bits/stdc++.h>

using namespace std;

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

int t,n,X;

int main()
{
    in >> t;
    for (int i = 1; i <= t; i++)
    {
        in >> n;
        X = 0;
        for (int j = 1; j <= n; j++)
        {
            int x;
            in >> x;
            X = X ^ x;
        }
        if (X == 0)
            out << "NU\n";
        else
            out << "DA\n";
    }
    return 0;
}