|
|
вернуться в форумWhy WA#1 type list = array[1..21] of longint; var n,i,w1,w2,d:integer; w:list; begin read(n); d:=0; For i:=1 to n do read(w[i]); If n=1 then begin write(w[1]); halt; end; For i:=1 to n div 2 do begin If w1>w2 then w2:=w2+abs(w[i+d]-w[i+d+1]) else w1:=w1+abs(w[i+d]-w[i+d+1]); d:=d+1; end; If n mod 2=0 then write(abs(w1-w2)) else write(w[n]-abs(w1-w2)); end. 1 1 is correct(1). 5 1 8 13 27 14 is correct(3). Test #5 is correct. Where is the mistake? Edited by author 08.08.2012 01:02 |
|
|