包子入侵 @ 2015-11-04 13:05:50
var z,x,i,j,n,m,w,h:longint;
a:array[1..10000]of longint;
procedure add;
begin
j:=z;
while a[j]<a[j-1] do
j:=j-1;
n:=j-1;
w:=10000;
for j:=n+1 to z do
if a[j]-a[n]<w then if a[j]>a[n] then begin w:=a[j]-a[n];h:=j;end;
m:=a[n];a[n]:=a[h];a[h]:=m;
for j:=1 to (z-n) div 2 do
begin
m:=a[n+j];a[n+j]:=a[z-j+1];a[z-j+1]:=m;
end;
end;
begin
readln(z);
readln(x);
for i:=1 to z do
read(a[i]);
for i:=1 to x do
add;
for i:=1 to z-1 do
write(a[i],' ');
write(a[z]);
end.
by 萌萌★小熊 @ 2016-09-01 15:08:36
50个一行
by yybyyb @ 2017-07-03 19:36:25
膜拜跟我使用同样头像的大佬
by WaReTle @ 2020-04-12 09:33:08
䯌䵻