Cod sursa(job #2239067)

Utilizator topala.andreiTopala Andrei topala.andrei Data 8 septembrie 2018 21:10:19
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("nim.in");
ofstream g("nim.out");
int main()
{
    int t, n, xors, objects;
    f >> t;
    while (t--)
    {
        f >> n;
        xors = 0;
        for (int i = 1; i <= n; i++)
        {
            f >> objects;
            xors = xors ^ objects;
        }
        if (xors != 0) g << "DA\n";
        else g << "NU\n";
    }
    return 0;
}