Var
a:array[0..maxint]of longint;
Procedure qs(lx,rx:longint);
Var
    i,j,t,x:longint;
Begin
    i:=lx; j:=rx; x:=a[(j+i) div 2];
    Repeat
      While a[i]<x do inc(i);
      While a[j]>x do dec(j);
      If i<=j then
        Begin
          t:=a[i]; a[i]:=a[j]; a[j]:=t;
          inc(i); dec(j)
        End
    Until i>j;
    If lx<j then qs(lx,j);
    If i<rx then qs(i,rx)
End;
Begin
randomize;
For a[0]:=1 to 100 do
    a[a[0]]:=random(1000)+1;
qs(1,100);
For a[0]:=1 to 100 do
    writeln(a[a[0]])
End.

相关文章:

  • 2022-01-21
  • 2021-06-26
  • 2021-09-08
  • 2021-06-28
  • 2021-07-14
  • 2021-09-27
猜你喜欢
  • 2021-12-18
  • 2022-12-23
  • 2021-06-23
  • 2021-09-15
相关资源
相似解决方案