Cod sursa(job #2200885)

Utilizator KenpachiDonoAndrei Grigoras KenpachiDono Data 2 mai 2018 21:14:03
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.58 kb
#include <fstream>
#include <bits/stdc++.h>
#define NMAX 10009

using namespace std ;

ofstream fout ( "nim.out" ) ;

int xr , T , value , nr ;

void read()
{
    freopen ( "nim.in", "r", stdin ) ;
    scanf ( "%d", &T ) ;
    for ( int i = 1 ; i <= T ; i++ )
    {
        scanf ( "%d", &nr ) ;
        xr = 0 ;
        for ( int j = 1 ; j <= nr ; j++ )
        {
            scanf ( "%d", &value ) ;
            xr = xr ^ value ;
        }
        if ( xr != 0 )
            fout << "DA" << '\n' ;
        else
            fout << "NU" << '\n' ;
    }
}

int main()
{
    read() ;
    return 0;
}