|
|
вернуться в форумDont work test №5 program kamni; var n, i, k, min, v,a,b: integer; m: array[1..1000] of int64; begin readln(n); for i := 1 to n do begin read (m[i]); end; for i := 1 to n - 1 do begin min := i; for k := i + 1 to n do if m[min] < m[k] then min := k; v := m[min]; m[min] := m[i]; m[i] := v; end; a:=0; b:=0; for i:=1 to n do if a-b<=0 then a:=a+m[i] else b:=b+m[i]; begin writeln(a-b); end; end. Re: Dont work test №5 6 1 4 5 6 7 9 why 2? 9+7=16 и 1+4+5+6=16 Re: Dont work test №5 o, senk you!) Edited by author 02.03.2012 01:01 Re: Dont work test №5 Послано Нурбол 7 июл 2012 18:36 Thank you =)) |
|
|