Cod sursa(job #2488344)

Utilizator Antonio020712Potra Antonio Antonio020712 Data 6 noiembrie 2019 18:48:37
Problema Jocul NIM Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include <fstream>

using namespace std;

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

int teste, gramezi, pietrePeGramada;

int main() {
    int i, j, s = 0;

    fin >> teste;
    for (i = 1; i <= teste; i++) {
        fin >> gramezi;
        s = 0;
        for (j = 1; j <= gramezi; j++) {
            fin >> pietrePeGramada;
            s = s ^ pietrePeGramada;
        }
        if (s > 0) 
            fout << "DA" << '\n';
        else 
            fout << "NU" << '\n';
    }

    fin.close();
    fout.close();

    return 0;
}