Pagini recente » Cod sursa (job #2815627) | Cod sursa (job #2778241) | Cod sursa (job #2207379) | Cod sursa (job #2558816) | Cod sursa (job #1413353)
var n,i:longint;
t:array[1..500000] of qword;
procedure qsort(l,r:qword);
var i,y,k,j:qword;
begin
i:=l;
j:=r;
k:=t[(l+r) div 2];
while t[i]<k do i:=i+1;
while t[j]>k do j:=j-1;
if i<=j then
begin
y:=t[i]; t[i]:=t[j]; t[j]:=y;
i:=i+1; j:=j-1;
end;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
assign(input,'algsort.in');
reset(input);
readln(n);
for i:=1 to n do
read(t[i]);
qsort(1,n);
close(input);
assign(output,'algsort.out');
rewrite(output);
for i:=1 to n-1 do
write(t[i],' ');
write(t[n]);
close(output);
end.