Cod sursa(job #1670081)

Utilizator cordun_cristinaCristina Maria Cordun cordun_cristina Data 31 martie 2016 13:52:26
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.41 kb
#include <iostream>
#include <fstream>

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

int n, m, s;

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