Cod sursa(job #1987247)

Utilizator flaviu_2001Craciun Ioan-Flaviu flaviu_2001 Data 29 mai 2017 23:45:05
Problema Jocul NIM Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.41 kb
#include <fstream>

using namespace std;

int n, t;

int main()
{
    ifstream fin ("nim.in");
    ofstream fout ("nim.out");
    fin >> t;
    while(t--){
        int s = 0;
        fin >> n;
        while(n--){
            int x;
            fin >> x;
            s ^= x;
        }
        if(s > 0)
            fout << "DA\n";
        else fout << "NU\n";
    }
    fin.close();
    fout.close();s
    return 0;
}