Cod sursa(job #1162316)

Utilizator tudorv96Tudor Varan tudorv96 Data 31 martie 2014 19:20:41
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb
#include <fstream>
using namespace std;

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

int t, n;

int main() {
    fin >> t;
    while (t--) {
        fin >> n;
        int x = 0;
        while (n--) {
            int nr;
            fin >> nr;
             x ^= nr;
        }
        if (x)
            fout << "DA\n";
        else
            fout << "NU\n";
    }
}