Cod sursa(job #1220474)

Utilizator ptquake10ptquake10 ptquake10 Data 17 august 2014 14:47:54
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <fstream>
using namespace std;

int t, n, s, x;

int main() {
	int x, y;
	
	freopen("nim.in","r",stdin);
	freopen("nim.out","w",stdout);
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		s = 0;
		for (int i = 0; i < n; i++){
			scanf("%d", &x);
			s ^= x;
		}
		if (s) {
			printf("DA\n");
		} else {
			printf("NU\n");
		}
	}
	
	return 0;
}