Cod sursa(job #1937193)
Utilizator | Data | 23 martie 2017 19:35:23 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("nim.in");
ofstream fout("nim.out");
int t, n, x, y;
int main()
{
fin >> t;
while ( t )
{
t--;
fin >> n;
fin >> x;
for ( int i = 1; i < n; i++ )
{
fin >> y;
x ^= y;
}
if ( x == 0 )
fout << "NU" << '\n';
else
fout << "DA" << '\n';
}
fin.close();
fout.close();
return 0;
}