Pagini recente » Cod sursa (job #624078) | Cod sursa (job #743009) | Cod sursa (job #137399) | Cod sursa (job #1255625) | Cod sursa (job #1182760)
Program ssm;
var n,i,pivot,aux,max,sol1,sol2,k,j : longint;
suma : array[0..6000000] of 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);
pivot:=0;
for i:=1 to n do begin
read(aux);
pivot:=pivot+1;
for j:=pivot downto 1 do begin
suma[j]:=suma[j]+aux;
if suma[j]>max then begin
max:=suma[j];
sol1:=i;
sol2:=j;
end;
end;
end;
writeln(max,' ',sol2,' ',sol1);
close(input);
close(output);
end.