Cod sursa(job #2393623)

Utilizator IoanaDraganescuIoana Draganescu IoanaDraganescu Data 31 martie 2019 19:15:12
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.49 kb
#include <iostream>
#include <fstream>
#include <deque>

using namespace std;

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

int main()
{
    int t;
    fin >> t;
    while (t--)
    {
        int n, x;
        fin >> n >> x;
        int s = x;
        for (int i = 2; i <= n; i++)
        {
            fin >> x;
            s = s ^ x;
        }
        if (s == 0)
            fout << "NU" << '\n';
        else
            fout << "DA" << '\n';
    }
    return 0;
}