Cod sursa(job #1951770)

Utilizator LaurIleIle Laurentiu Daniel LaurIle Data 3 aprilie 2017 19:45:16
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    ifstream f("nim.in");
    ofstream g("nim.out");
    int n, t;
    f >> t;
    for( ; t; --t)
    {
        f >> n;
        int x, s=0;
        for(int i=0; i<n; ++i)
            f >> x, s = s ^ x;
        if(s)
            g << "DA" << '\n';
        else
            g << "NU" << '\n';
    }
    f.close();
    g.close();
    return 0;
}