Cod sursa(job #1114158)

Utilizator PatrikStepan Patrik Patrik Data 21 februarie 2014 12:40:14
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
    #include<cstdio>
    using namespace std;
    int T, N , x, y;

    int main()
    {
        freopen("nim.in" , "r" , stdin );
        freopen("nim.out" , "w" , stdout );
        scanf("%d" , &T );
        for(int i = 1; i <= T ; ++ i)
        {
            scanf("%d" , &N );
            int x = 0;
            for(int j = 1 ; j <= N ; ++j)
            {
                scanf("%d" , &y);
                x = x^y;
            }
            if(x)printf("DA\n");
            else printf("NU\n");
        }
        return 0;
    }