Pagini recente » Cod sursa (job #1644670) | Cod sursa (job #16643) | Cod sursa (job #2880045) | Cod sursa (job #178414) | Cod sursa (job #696476)
Cod sursa(job #696476)
var a,v:array[0..6000000] of longint;
n,bb,aa,a1,b,max,s:longint;
i:longint;
f,g:text;
begin
assign(f,'ssm.in'); reset (f);
assign(g,'ssm.out'); rewrite (g);
readln (f,n);
max:=-maxlongint;
b:=1;
for i:=1 to n do
begin read (f,v[i]);
s:=v[i]+a[i-1];
if (s>=v[i]) then a[i]:=s
else begin a[i]:=v[i];
a1:=i;
end;
if (max<=a[i]) then begin max:=a[i]; aa:=a1; bb:=b; end;
b:=b+1;
end;
write (g,max,' ',aa,' ',bb);
close (f);
close (g);
end.