Pagini recente » Cod sursa (job #591020) | Cod sursa (job #335778) | Cod sursa (job #1209625) | Cod sursa (job #1440407) | Cod sursa (job #1182778)
Program ssm;
var n,i,pivot,aux,max,sbest,suma,sol1,sol2 : longint;
buf1,buf2 : array [0..1 shl 17] of char;
begin
assign(input,'ssm.in'); settextbuf(input,buf1); reset(input);
assign(output,'ssm.out'); settextbuf(output,buf2); rewrite(output);
readln(n);
for i:=1 to n do begin
read(aux);
suma:=suma+aux;
pivot:=pivot+1;
if aux>=suma then begin
suma:=aux;
pivot:=0;
end;
if suma>=sbest then begin
sbest:=suma;
sol2:=i;
sol1:=i-pivot;
end;
end;
writeln(sbest,' ',sol1,' ',sol2);
close(input);
close(output);
end.