Cod sursa(job #3328351)

Utilizator Razvan23Razvan Mosanu Razvan23 Data 7 decembrie 2025 21:00:39
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <bits/stdc++.h>
using namespace std;

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

int n, m;
int x, y;

int main()
{
    ios_base::sync_with_stdio(0);
    fin.tie(0);
    fout.tie(0);
    int i;
    fin >> n;
    while(n--)
    {
        fin >> m;
        fin >> x;
        m--;
        while(m--)
        {
            fin >> y;
            x = x ^ y;
        }
        if(x == 0) fout << "NU\n";
        else fout << "DA\n";
    }
    fin.close();
    fout.close();
    return 0;
}