Pagini recente » Borderou de evaluare (job #2437721) | Cod sursa (job #2854534) | Cod sursa (job #665133) | Cod sursa (job #764392) | Cod sursa (job #487723)
Cod sursa(job #487723)
var n,s,smax,nr,i,ind,st,fn:longint;
f,g:text;
begin
assign(f,'ssm.in'); reset(f);
assign(g,'ssm.out'); rewrite(g);
read(f,n);
s:=-1;
for i:=1 to n do begin
read(f,nr);
if (s<0) then begin s:=nr; ind:=i; end
else s:=s+nr;
if s>smax then begin smax:=s; st:=ind; fn:=i; end;
end;
write(g,smax,' ',st,' ',fn);
close(g);
end.