Cod sursa(job #2766588)
Utilizator | Data | 2 august 2021 14:01:24 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <fstream>
using namespace std;
ifstream fin("nim.in");
ofstream fout("nim.out");
int t, n, x;
int main() {
fin >> t;
while(t > 0) {
fin >> n;
int xorSum = 0;
for(int i = 1; i <= n; i++) {
fin >> x;
xorSum ^= x;
}
fout << (xorSum ? "DA\n" : "NU\n");
t--;
}
fin.close();
fout.close();
return 0;
}