ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1005. Stone Pile

Dont work test №5
Posted by Sega_As 21 Feb 2012 21:36
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
Posted by Sega_As 21 Feb 2012 22:21
6
1 4 5 6 7 9
why 2?
9+7=16 и 1+4+5+6=16
Re: Dont work test №5
Posted by x-positive 2 Mar 2012 01:00
o, senk you!)

Edited by author 02.03.2012 01:01
Re: Dont work test №5
Posted by Нурбол 7 Jul 2012 18:36
Thank you =))