Cod sursa(job #2370527)

Utilizator waren4Marius Radu waren4 Data 6 martie 2019 12:32:14
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.48 kb
#include <iostream>
#include <fstream>
#include <vector>
#include <stack>

using namespace std;

ifstream f("nim.in"); ofstream g("nim.out");

int n,t,s;

int main() {
    int i,j,x;
    f>>t;
    for(i = 1; i <= t; ++i) {
        f>>n;
        s = 0;
        for(j = 1; j <= n; ++j) {
            f>>x;
            s = s ^ x;
        }
        if(s > 0) {
            g<<"DA\n";
        }
        else {
            g<<"NU\n";
        }
    }
    return 0;
}