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