Cod sursa(job #2017107)
Utilizator | Data | 31 august 2017 12:21:00 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("nim.in");
ofstream out("nim.out");
int t, n;
int xxor;
int main()
{
in >> t;
for(int i = 1; i <= t; i++) {
in >> n;
xxor = 0;
for(int j = 1; j <= n; j++) {
int x;
in >> x;
xxor ^= x;
}
if(xxor == 0) {
out << "NU\n";
} else {
out << "DA\n";
}
}
return 0;
}