Cod sursa(job #2859377)
Utilizator | Data | 1 martie 2022 11:37:06 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <bits/stdc++.h>
using namespace std;
int main() {
ifstream f("nim.in");
ofstream g("nim.out");
int t; f >> t;
for(int cas=1; cas<=t; cas++) {
int n; f >> n;
int rez = 0;
for(int i=1; i<=n; i++) {
int x; f >> x;
rez = rez ^ x;
}
if(rez) g << "DA\n";
else g << "NU\n";
}
return 0;
}