Cod sursa(job #1182994)
| Utilizator | Data | 8 mai 2014 11:49:10 | |
|---|---|---|---|
| Problema | Jocul NIM | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
// pb11procon.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include "fstream"
#include "iostream"
using namespace std;
int NrGroups;
int Groups[100001];
int main()
{
ifstream f("nim.in");
ofstream g("nim.out");
int Nrt;
f>>Nrt;
for(int q = 0 ; q < Nrt ; q ++)
{
f>>NrGroups;
for(int i = 0 ; i < NrGroups ; i ++)
f>>Groups[i];
int x = Groups[0];
for(int i = 1 ; i < NrGroups ; i ++)
x = x ^ Groups[i];
if(x == 0)
g<<"DA\n";
else
g<<"NU\n";
}
return 0;
}
