Cod sursa(job #696146)

Utilizator deneoAdrian Craciun deneo Data 28 februarie 2012 17:08:49
Problema Jocul NIM Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb
#include <fstream>
using namespace std;

int t, n, rez;

int main() {
    int i, j, k;
    ifstream fin("nim.in");
    ofstream fout("nim.out");
    fin >> t;
    for(i = 1; i <= t; ++i) {
        fin >> n; rez = 0;
        for(j = 1; j <= n; ++j) {
            fin >> k;
            rez ^= k;
        }
        if(rez == 0)
            fout << "NU\n";
        else
            fout << "DA\n";
    }
    fout.close();
    return 0;
}