Cod sursa(job #774484)

Utilizator luckyme91wiz kid luckyme91 Data 5 august 2012 01:41:28
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.42 kb
#include <fstream>

using namespace std;

int main () {

    int t, n, x, res;
    ifstream in ("nim.in", ifstream::in);
    ofstream out ("nim.out", ofstream::out);
    in >> t;
    while (t--)
    {
        in >> n;
        in >> res;
        n--;
        while (n--)
        {
            in >> x;
            res ^= x;
        }
        if (res == 0)
            out << "NU\n";
        else
            out << "DA\n";
    }
}