Cod sursa(job #2389844)

Utilizator victorv88Veltan Victor victorv88 Data 27 martie 2019 15:28:51
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include <iostream>
#include <fstream>
using namespace std;

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

int t, n, x, s;

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