Pagini recente » Cod sursa (job #2337522) | Cod sursa (job #3188296) | Cod sursa (job #1052426) | Cod sursa (job #1048378) | Cod sursa (job #264665)
Cod sursa(job #264665)
var a:array[1..500000]of integer;
n,k,i,s,max,nr:longint;
begin
assign(input,'secventa.in');reset(input);
assign(output,'secventa.out');rewrite(output);
readln(n,k);
for i:=1 to n do
read(a[i]);
s:=0;
max:=0;
nr:=0;
for i:=1 to n-2 do begin
s:=a[i]+a[i+1]+a[i+2];
if s>max then begin
max:=s; nr:=i; end; end;
if a[nr]>a[nr+2] then
write(a[nr],' ',a[nr+1],' ',a[nr+2])
else
write(a[nr+2],' ',a[nr+1],' ',a[nr]);
close(input);close(output);
end.