- 明明的随机数
- 2009-02-24 17:01:53 @
请大牛帮忙看看,哪里错了???
var
i,j,k,l,m,n,h:integer;
a,b:array[1..100]of integer;
begin
read(n);
for i:=1 to n do
begin
read(a[i]);
b[i]:=a[i];
end;
for i:=1 to n do
for j:=i+1 to n do
begin
if a[i]=b[j] then b[j]:=0;
end;
for i:=1 to n do
if b[i]=0 then begin
for m:=i to n do begin
a[m]:=a[m+1];
b[m]:=b[m+1];
end;
n:=n-1;
end;
k:=n;
writeln(k);
for i:=1 to k do
for j:=i to k do
begin
if a[i]>a[j] then
begin
h:=a[i];
a[i]:=a[j];
a[j]:=h;
end;
end;
for i:=1 to k do
write(a[i],' ');
readln;
end.
1 条评论
-
也许也从未 LV 5 @ 2014-10-21 20:55:28
我用的c,不能看懂你的代码,不过你可以试试桶排
- 1