Cod sursa(job #2832259)
| Utilizator | Data | 13 ianuarie 2022 11:18:17 | |
|---|---|---|---|
| Problema | Jocul NIM | Scor | 100 |
| Compilator | c-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.38 kb |
#include <stdio.h>
int main()
{
FILE *in = fopen("nim.in", "rt"), *out = fopen("nim.out", "wt");
int t, n, x;
fscanf(in, "%d", &t);
while(t--) {
int xor_sum = 0;
fscanf(in, "%d", &n);
for (int i = 1; i <= n; ++i) {
fscanf(in, "%d", &x);
xor_sum ^= x;
}
if (xor_sum)
fprintf(out, "DA\n");
else
fprintf(out, "NU\n");
}
fclose(in);
fclose(out);
return 0;
}