Pagini recente » Rating Lixandru Calin-Mihai (calinlixandru) | Cod sursa (job #2357059) | Cod sursa (job #885237) | Cod sursa (job #2487837) | Cod sursa (job #1182775)
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.