Pagini recente » Cod sursa (job #1432897) | Cod sursa (job #1222782) | Cod sursa (job #300150) | Cod sursa (job #653393) | Cod sursa (job #413985)
Cod sursa(job #413985)
var
s,smax:longint;
a:integer;
i,p,pint,u,n:word;
f,g:text;
begin
assign(f,'sumamax.in');
reset(f);
readln(f,n);
smax:=-maxint;
s:=0;
p:=1; u:=1; pint:=1;
for I:=1 to n do
begin
read(f,a);
if s<0
then
begin
s:=0;
pint:=i;
end;
s:=s+a;
if s>smax
then
begin
smax:=s;
u:=i;
p:=pint;
end;
end;
close(f);
assign(g,'sumamax.out');
rewrite(g);
writeln(g,p,' ',u,' ',smax);
close(g);
end.