#1 lzx2013@2012-12-08 05:37:00
29029
回复
删除
用哈希表
program t1;
var a:array[0..1001] of boolean;
n,x,s,i,s1:integer;
begin
readln(n);
for i:=1 to n do
begin
read(x);
a[x]:=true;
end;
s:=0;
for i:=1 to 1000 do
if a[i] then s:=s+1;
writeln(s);
s1:=0;
for i:=1 to 1000 do
begin
if a[i] then
begin
s1:=s1+1;
if s1=s then break else write(i,' ');
end;
end;
writeln(i);
end.
这道题至少做过2遍