Pagini recente » Cod sursa (job #1986021) | Cod sursa (job #2945289) | Cod sursa (job #2511972) | Cod sursa (job #2516447) | Cod sursa (job #393153)
Cod sursa(job #393153)
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.