Cod sursa(job #1761714)

Utilizator killer301Ioan Andrei Nicolae killer301 Data 22 septembrie 2016 19:23:09
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include <cstdio>

using namespace std;

int main()
{
    freopen("nim.in", "r", stdin);
    freopen("nim.out", "w", stdout);

    int teste;
    scanf("%d", &teste);

    for(int i = 1; i <= teste; ++i)
    {
        int n;
        scanf("%d", &n);

        int val;

        scanf("%d", &val);

        for(int j = 2; j <= n; ++j)
        {
            int aux;
            scanf("%d", &aux);
            val ^= aux;
        }

        printf("%s\n", val > 0 ? "DA" : "NU");
    }

    return 0;
}