Pagini recente » Cod sursa (job #1163011) | Cod sursa (job #248387) | Cod sursa (job #335204) | Cod sursa (job #699094) | Cod sursa (job #769459)
Cod sursa(job #769459)
var n,s,i,di,ds,dsf,ins,ini,l,insf:longint; buf:array[1..1 shl 20]of char;
begin
assign(input,'ssm.in'); reset(input); settextbuf(input,buf);
read(n);
for i:=1 to n do begin
read(l);
if i=1 then begin ins:=l; ini:=i; insf:=i; di:=1; ds:=l; dsf:=i end
else
if l>ins+l then begin ins:=l; ini:=i; insf:=i end
else begin
ins:=l+ins;
insf:=i;
end;
if ins>ds then begin
ds:=ins;
di:=ini;
dsf:=i;
end
end;
assign(output,'ssm.out'); rewrite(output);
writeln(ds,' ',di,' ',dsf);
close(output);
end.