Cod sursa(job #2698268)

Utilizator chriss_b_001Cristian Benghe chriss_b_001 Data 21 ianuarie 2021 16:38:48
Problema Jocul NIM Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.39 kb
#include <iostream>
#include <fstream>

using namespace std;

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

int x, n, S;

int main()
{
    int T;
    f >> T;
    while(T--)
    {
        f >> n;
        while(n--)
        {
            f >> x;
            S ^= x;
        }
        if(S != 0)
            g << "DA\n";
        else g << "NU\n";
    }

    return 0;
}