Cod sursa(job #2427563)

Utilizator PrekzursilAndrei Visalon Prekzursil Data 31 mai 2019 23:31:51
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.5 kb
#include <stdio.h>
int main() {
  FILE *fin = fopen( "nim.in", "r" );
  FILE *fout = fopen( "nim.out", "w" );
  int n, i, m, in, sxor, nr;
  fscanf( fin, "%d", &n );
  for ( in = 0; in < n; ++in ) {
    fscanf( fin, "%d", &m );
    sxor = 0;
    for ( i = 0; i < m; ++i ) {
      fscanf( fin, "%d", &nr );
      sxor ^= nr;
    }
    if ( sxor == 0 ) {
      fprintf( fout, "NU\n" );
    } else {
      fprintf( fout, "DA\n" );
    }
  }
  fclose( fin );
  fclose( fout );
  return 0;
}