Cod sursa(job #1967011)

Utilizator RobybrasovRobert Hangu Robybrasov Data 15 aprilie 2017 19:43:46
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.35 kb
#include <fstream>

using namespace std;

int main() {
    ifstream fin("nim.in");
    ofstream fout("nim.out");
    int t;
    fin >> t;
    while (t--) {
        int n;
        fin >> n;
        int v = 0;
        int a;
        while (n--) {
            fin >> a;
            v ^= a;
        }
        fout << (v != 0 ? "DA\n" : "NU\n");
    }
    return 0;
}