Cod sursa(job #3285643)

Utilizator TeodorLuchianovTeo Luchianov TeodorLuchianov Data 13 martie 2025 11:57:45
Problema Jocul NIM Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream in("nim.in");
ofstream out("nim.our");

int main() {

  int t;
  in >> t;
  for(int q = 1;q <= t;q++) {
    int n, ans = 0;
    in >> n;
    for(int i = 1;i <= n;i++) {
      int c;
      in >> c;
      ans ^= c;
    }
    if(ans == 0) {
      out << "NU\n";
    }else {
      out << "DA\n";
    }
  }
  out << '\n';
  return 0;
}