/ Vijos / 讨论 / 问答 /

程序比答案长什么意思啊?怎么解决?

program suijishu;

var

n,i,j,k,temp,m:integer;

a:array[1..100] of integer;

begin

readln(n);

for i:=1 to n do

read(a[i]);

for i:=1 to n-1 do

for j:=i+1 to n do

if a[i]=a[j] then begin

for k:=j+1 to n do

a[k-1]:=a[k];

n:=n-1;

end;

m:=n;

for i:=1 to n-1 do

for j:=i+1 to n do

if a[i]>a[j] then begin

temp:=a[i];

a[i]:=a[j];

a[j]:=temp;

end;

writeln(m);

for i:=1 to m do

write(a[i],' ');

end.

2 条评论

  • @ 2009-07-25 07:37:32

    控制位数 ?????????

  • @ 2009-07-24 21:08:24

    虽然是FPC的我看不懂,但是好像意思是你输出数字位数比正确答案要长,也就是答案错误呗

  • 1