Pagini recente » Cod sursa (job #2111196) | Cod sursa (job #1018944) | Cod sursa (job #319851) | Cod sursa (job #1952770) | Cod sursa (job #1180541)
var n,i,j,sum,imax,jmax,smax,x,v:longint;
bufin:array[1..65000]of byte;
begin
assign(input,'ssm.in'); reset(input);
assign(output,'ssm.out'); rewrite(output);
settextbuf(input,bufin);
readln(n);
read(sum); i := 1 ; imax := 1; jmax := 1; smax := sum;
for j := 2 to n do
begin
read(x);
v := sum+x;
if x > v then
begin
sum := x;
i := j;
end
else
sum := v;
if smax < sum then begin smax := sum; imax := i; jmax := j; end;
end;
writeln(smax,' ',imax,' ',jmax);
close(input);
close(output);
end.