Cod sursa(job #2702713)
Utilizator | Data | 5 februarie 2021 16:10:53 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("nim.in");
ofstream g("nim.out");
int main()
{
int T, N, x, S;
f >> T;
while(T--)
{
f >> N;
S = 0;
while(N--)
{
f >> x;
S ^= x;
}
g << (S != 0 ? "DA\n" : "NU\n");
}
f.close();
g.close();
return 0;
}