Pagini recente » Profil Adriana_S | Profil Robybrasov | Istoria paginii runda/onis-2014-runda-4 | Profil terrilyn5017 | Cod sursa (job #407777)
Cod sursa(job #407777)
var n,i,pi,pozi,pozf,x,sc,smax:longint;
g,f:text;
begin
assign(f,'ssm.in');
reset(f);
assign(g,'ssm.out');
rewrite(g);
readln(f,n);
sc:=0;
smax:=-maxlongint;
for i:=1 to n do
begin
read(f,x);
if sc<0 then
begin
sc:=0;
pi:=i;
end;
sc:=sc+x;
if sc>smax then
begin
smax:=sc;
pozi:=pi;
pozf:=i;
end;
end;
writeln(g,smax,' ',pozi,' ',pozf);
close(g);
end.