Cod sursa(job #2138012)
Utilizator | Data | 21 februarie 2018 10:53:47 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("nim.in");
ofstream g("nim.out");
int i,t,xors,n,j,x;
int main()
{
f>>t;
for(i=1;i<=t;i++)
{
f>>n;
xors=0;
for(j=1;j<=n;j++)
{
f>>x;
xors=xors ^ x;
}
if(xors>0)
g<<"DA"<<endl;
else
g<<"NU"<<endl;
}
}