Cod sursa(job #3252196)

Utilizator stefan_dore_Stefan Dore stefan_dore_ Data 28 octombrie 2024 19:53:15
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.38 kb
#include <iostream>
#include <fstream>
using namespace std;

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

int main()
{
    int T, N, x, s;
    f >> T;
    while(T--) {
        f >> N;
        s = 0;
        while(N--) {
            f >> x;
            s ^= x;
        }
        g << (s != 0 ? "DA\n" : "NU\n");
    }
    f.close();
    g.close();
    return 0;
}