Cod sursa(job #3350680)

Utilizator marap2011Paun Mara marap2011 Data 11 aprilie 2026 19:33:16
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.62 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin ("nim.in") ;
ofstream fout ("nim.out") ;

void solve ()
{
    int q ;
    fin >> q ;
    while ( q -- )
    {
        int n ;
        fin >> n ;
        int s = 0 ;
        for ( int i = 1 ; i <= n ; i ++ )
        {
            int x ;
            fin >> x ;
            s ^= x ;
        }
        if ( s != 0 )
            fout << "DA" ;
        else
            fout << "NU" ;
        fout << '\n' ;
    }
}

signed main ()
{
    std :: ios_base :: sync_with_stdio ( false ) ;
    fin.tie(0) ;
    fout.tie(0) ;
    solve () ;
}