Cod sursa(job #723139)

Utilizator ionutz32Ilie Ionut ionutz32 Data 24 martie 2012 22:57:29
Problema Jocul NIM Scor 100
Compilator fpc Status done
Runda Arhiva educationala Marime 0.46 kb
var n,t,i,j,x,s:longint;
f,g:text;
bufin,bufout:array[1..65000] of byte;
begin
assign(f,'nim.in');
assign(g,'nim.out');
reset(f);rewrite(g);
settextbuf(f,bufin);
settextbuf(g,bufout);
readln(f,t);
for i:=1 to t do
    begin
    read(f,n);
    s:=0;
    for j:=1 to n do
        begin
        read(f,x);
        s:=s xor x;
        end;
    if s=0 then
       writeln(g,'NU')
    else
        writeln(g,'DA');
    end;
close(f);close(g);
end.