Cod sursa(job #2806427)

Utilizator Xutzu358Ignat Alex Xutzu358 Data 22 noiembrie 2021 17:17:59
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 f("nim.in");
ofstream g("nim.out");

int t,n,x,s;

int main()
{
    f >> t;
    for (int k=1;k<=t;k++) {
        f >> n; s=0;
        for (int i=1;i<=n;i++) {
            f >> x;
            s ^= x;
        }
        if (s==0) {
            g << "NU" << '\n';
        }
        else {
            g << "DA" << '\n';
        }
    }
    return 0;
}