Cod sursa(job #2867314)
Utilizator | Data | 10 martie 2022 11:58:09 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.46 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("nim.in");
ofstream fout("nim.out");
int t, n;
int main()
{
int xor_sum, x;
fin >> t;
while(t--)
{
xor_sum = 0;
fin >> n;
for(int i = 1; i <= n; i++)
{
fin >> x;
xor_sum ^= x;
}
if(xor_sum == 0)
fout << "NU\n";
else fout << "DA\n";
}
fout.close();
return 0;
}