Cod sursa(job #1473753)
Utilizator | Data | 20 august 2015 08:16:51 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <fstream>
using namespace std;
constexpr char raspunsuri[][4] = {"NU\n", "DA\n"};
int main(){
ifstream f("nim.in");
ofstream g("nim.out");
int t = 0;
f >> t;
for(int i = 0; i < t; ++i){
int n = 0;
f >> n;
int rez = 0;
for(int j = 0, x; j < n; ++j){
f >> x;
rez ^= x; }
g << raspunsuri[rez!=0]; }
return 0; }