Cod sursa(job #1307886)

Utilizator danyro364Savu Ioan Daniel danyro364 Data 2 ianuarie 2015 23:43:12
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    int n,k,p,x;
    ifstream f("nim.in");
    ofstream g("nim.out");
    f>>k;
    for(int i=1;i<=k;i++)
    {
        f>>n;x=0;
        for(int j=1;j<=n;j++)
        {
            f>>p;
            x=x xor p;
        }
        if(x)
            g<<"DA\n";
        else g<<"NU\n";
    }
    return 0;
}