Pagini recente » Cod sursa (job #2807825) | Cod sursa (job #1880075) | Cod sursa (job #1987158) | Cod sursa (job #1048030) | Cod sursa (job #1182769)
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;
if aux>suma then begin
suma:=aux;
sol1:=i;
end;
if suma>sbest then begin
sbest:=suma;
sol2:=i;
end;
end;
writeln(sbest,' ',sol1,' ',sol2);
close(input);
close(output);
end.