Pagini recente » Cod sursa (job #2448595) | Cod sursa (job #1547963) | Cod sursa (job #2081251) | Cod sursa (job #366995) | Cod sursa (job #342213)
Cod sursa(job #342213)
var i,j,n,b,incepe,x,l,max,maxi,maxl:longint;
t:text;
begin
b:=-2000000001;
max:=b;
assign(t,'ssm.in'); reset(t);
readln(t,n);
for i:=1 to n do
begin
read(t,x);
if (b<0) then
begin
b:=x;
incepe:=i;
l:=1;
end
else
begin
b:=b+x;
inc(l);
end;
if ((max<b) ) then
begin
max:=b;
maxi:=incepe;
maxl:=i;
end;
end;
assign(t,'ssm.out'); rewrite(t);
write(t,max,' ',maxi,' ',maxl);
close(t);
end.