Cod sursa(job #2282884)

Utilizator GarboteialexGarbotei Alex Garboteialex Data 14 noiembrie 2018 18:13:50
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda alexei_lr1 Marime 0.32 kb
#include <fstream>

using namespace std;

ifstream fin("nim.in");
ofstream fout("nim.out");

int t,n,nim;

int main() 
{
	fin >> t;
	for(int i = 1; i <= t; i++) 
	{
		fin >> n;
		int xs = 0;
		for(int j = 1; j <= n; j++) 
		{
			fin >> nim;
			xs ^= nim;
		}

		if(xs) fout << "DA" << '\n';
		else fout << "NU" << '\n';
	}
}