Cod sursa(job #2701790)

Utilizator Ioana_GaborGabor Ioana Ioana_Gabor Data 1 februarie 2021 18:45:35
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.43 kb
#include <bits/stdc++.h>
#define NMAX 10000

using namespace std;

ifstream fi("nim.in");
ofstream fo("nim.out");

int t;
int n,el;
int sum;

int main(){
    fi>>t;
    while(t--){
        fi>>n;
        sum=0;
        for(int i=1;i<=n;i++){
            fi>>el;
            sum=sum^el;
        }
        if(sum==0){
            fo<<"NU"<<'\n';
        }else{
            fo<<"DA"<<'\n';
        }
    }
    fi.close();
    fo.close();
}