Cod sursa(job #975132)
Utilizator | Emanuel Truta manutruta | Data | 19 iulie 2013 10:40:27 |
---|---|---|---|
Problema | Jocul NIM | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("nim.in");
ofstream g("nim.out");
int main()
{
int t, s;
f >> t;
for(int i = 1; i <= t; i++)
{
int n;
s = 0;
for(int j = 1; j <= n; j++)
{
int aux;
f >>aux;
s ^= aux;
}
if(s == 0) g << "NU" << '/n';
else g << "DA" << '/n';
}
return 0;
}