Cod sursa(job #2702216)

Utilizator cristia_razvanCristia Razvan cristia_razvan Data 3 februarie 2021 10:43:24
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 fin("nim.in");
ofstream fout("nim.out");

int t, n;

int main()
{
    int x, ans;
    fin >> t;
    while(t--)
    {
        fin >> n;
        ans = 0;
        for(int i = 1; i <= n; i++)
        {
            fin >> x;
            ans = (ans^x);
        }
        fout << ((ans != 0 ) ? "DA\n" : "NU\n");
    }

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