Pagini recente » Cod sursa (job #2084032) | Cod sursa (job #1986500) | Cod sursa (job #255072) | Cod sursa (job #3273129) | Cod sursa (job #393148)
Cod sursa(job #393148)
var bufin:array[1..65000] of byte;
i,n,x,s,smax,p1,p2:longint;
begin
assign(input,'smm.in');
reset(input);
settextbuf(input,bufin);
assign(output,'smm.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;
writeln(smax,' ',p1,' ',p2);
close(input);
close(output);
end.