Cod sursa(job #608904)
Utilizator | Data | 18 august 2011 16:50:14 | |
---|---|---|---|
Problema | Jocul NIM | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <fstream>
using namespace std;
ifstream f("nim.in");
ofstream g("nim.out");
int t,ti,x,i,sumax,n;
int main() {
f >> t;
for (ti=1;ti<=t;ti++) {
f >> n;sumax=0;
for (i=1;i<=n;i++) {
f >> x;
sumax^=x;
}
if (sumax>0) g << "DA" << '\n';
else g << "NU" << '\n';
}
f.close();g.close();
return 0;
}