底線部份不是很明白 能解說嗎?
var a:array[1..100] of integer;
b:array[1..1000] of integer;
s,i,n:integer;begin
assign(input,'random.in'); reset(input);
assign(output,'random.out'); rewrite(output);
readln(n);
for i:=1 to n do read(a[i]);
readln; for i:=1 to n do b[a[i]]:=1;
s:=0;
for i:=1 to 1000 do if b[i]=1 then inc(s);
writeln(s);
for i:=1 to 1000 do if b[i]=1 then write(i,' ');
writeln;
close(input);
close(output);
end.