language: Pascal (fpc) (fpc 2.2.0)
date: 102 days 7 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var
a:array[1..1000] of longint;
b,size:longint;
 
procedure qs(l,r:longint);
var
   i,j,x,temp:longint;
begin
   x:=a[(l+r) div 2];
   i:=l;
   j:=r;
   while (i<=j) do begin
      while (a[i]<x) do i:=i+1;
      while (a[j]>x) do j:=j-1;
      if (i<=j) then begin
         temp:=a[i];
         a[i]:=a[j];
         a[j]:=temp;
         i:=i+1;
         j:=j-1;
      end;
   end;
   if (l<j) then qs(l,j);
   if (i<r) then qs(i,r);
end;
begin
while not eof do begin
Readln(size);
qs(1,size);
For b := 1 to size do begin
Writeln(a[b]);
End;
end;
end.