题目: |
program test_0904;
const n=1000000;
const max=16;
var
i,j:longint;
a:array[1..n] of integer;
x:longint;
begin
for i:=1 to max do
begin
read(x);
a[x]:=a[x]+1;
end;
for j:=n downto 1 do if a[j]<>0 then for i:=1 to a[j] do write(j,' ');
end.
输入:1 2 3 4 100 200 300 400 1 2 3 4 1000 2000 3000 4000 输出:4000 3000 2000 1000 400 300 200 100 4 4 3 3 2 2 1 1
|