Cod sursa(job #1171112)
Utilizator | Data | 15 aprilie 2014 10:12:52 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main()
{ifstream f("nim.in");
ofstream g("nim.out");
int t,x,a,i,j,n;
f>>t;
for(i=1;i<=t;i++)
{f>>n;
x=0;
for(j=1;j<=n;j++)
{f>>a;
x=x^a;
}
if((x==0)||(x==1))
g<<"DA"<<'\n';
else
g<<"NU"<<'\n';
}
}