Cod sursa(job #3237687)

Utilizator tsg38Tsg Tsg tsg38 Data 11 iulie 2024 20:07:06
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.39 kb
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

int main() {
  ios_base::sync_with_stdio(0);
  fin.tie(0);
  int t, n, s, x;

  fin >> t;
  while ( t-- ) {
	fin >> n;
	s = 0;
	for ( int i = 1; i <= n; ++i ) {
      fin >> x;
	  s ^= x;
	}
	fout << (s == 0 ? "NU\n" : "DA\n");
  }
  fin.close();
  fout.close();
  return 0;
}