Cod sursa(job #631107)

Utilizator floringh06Florin Ghesu floringh06 Data 6 noiembrie 2011 23:50:54
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include <cstdio>

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