Cod sursa(job #2544547)

Utilizator Mihai145Oprea Mihai Adrian Mihai145 Data 12 februarie 2020 11:02:38
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.47 kb
#include <fstream>

using namespace std;

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

int main()
{
    int t; fin >> t;

    while(t--)
    {
        int n, x;
        int xorsum = 0;

        fin >> n;

        for(int i = 1; i <= n; i++)
            {
                fin >> x;
                xorsum ^= x;
            }

        if(xorsum == 0)
            fout << "NU\n";
        else
            fout << "DA\n";
    }

    return 0;
}