Cod sursa(job #1882623)

Utilizator andreigasparoviciAndrei Gasparovici andreigasparovici Data 17 februarie 2017 12:52:26
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb
#include <stdio.h>

int t, n;

int main()
{
    freopen("nim.in","r",stdin);
    freopen("nim.out","w",stdout);
    scanf("%d ",&t);
    while(t--)
    {
        scanf("%d ",&n);
        int a,b;
        scanf("%d ",&a);
        for(int i=1;i<n;i++)
        {
            scanf("%d ",&b);
            a^=b;
        }
        printf("%s\n",a?"DA":"NU");
    }
    return 0;
}