Pagini recente » Cod sursa (job #817533) | Cod sursa (job #2004423) | Cod sursa (job #1985826) | Cod sursa (job #1750980) | Cod sursa (job #393149)
Cod sursa(job #393149)
var bufin:array[1..65000] of byte;
i,n,x,s,smax,p1,p2:longint;
begin
assign(input,'ssm.in');
reset(input);
settextbuf(input,bufin);
assign(output,'ssm.out');
rewrite(output);
readln(n);
read(s);
smax:=-2000000000;
p1:=1;
for i:=2 to n do begin
read(x);
if x+s>x then s:=s+x else begin
s:=x;
p1:=i;
end;
if s>smax then begin
smax:=s;
p2:=i;
end;
end;
write(smax,' ',p1,' ',p2);
close(input);
close(output);
end.