Cod sursa(job #3367900)

Utilizator alex_0747Gheorghica Alexandru alex_0747 Data 11 octombrie 2026 22:47:48
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <bits/stdc++.h>
using namespace std;

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

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