Cod sursa(job #2200865)

Utilizator Vlad_lsc2008Lungu Vlad Vlad_lsc2008 Data 2 mai 2018 20:55:56
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.42 kb
#include<iostream>
#include<fstream>
using namespace std;

int main()
{
    ifstream t1("nim.in");
    ofstream t2("nim.out");
    int t,n,sumxor,a;
    t1>>t;
    for(;t;t--)
    {
        t1>>n;
        sumxor=0;
        for(;n;n--)
        {
            t1>>a;
            sumxor^=a;
        }
        if(sumxor>0) t2<<"DA\n";
        else t2<<"NU\n";
    }
    t1.close();
    t2.close();
    return 0;
}