Cod sursa(job #2105228)
Utilizator | Data | 12 ianuarie 2018 20:56:10 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream f ("nim.in");
ofstream g ("nim.out");
string sol[2]={"NU","DA"};
int t,n,x,y;
int main()
{
f>>t;
while(t--)
{
f>>n;
x=0;
while(n--)
{
f>>y;
x^=y;
}
if(x) x=1;
g<<sol[x]<<'\n';
}
return 0;
}