Cod sursa(job #2290859)

Utilizator radugheoRadu Mihai Gheorghe radugheo Data 27 noiembrie 2018 09:16:54
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <fstream>

using namespace std;

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

int i, n, sol, x, t, j;

int main(){
    fin >> t;
    for (j=1; j<=t; j++){
        fin >> n;
        sol = 0;
        for (i=1; i<=n; i++){
            fin >> x;
            sol ^= x;
        }
        if (sol == 0)
            fout << "NU\n";
        else
            fout << "DA\n";
    }
    return 0;
}