S.C.Q. 2012-08-08 00:49:00
点我顶贴
收藏
删除
RT。。 我也是计数排,空间无问题。。快排别人还不是开了那么大空间。。
program tongjishuzi;
var
n:longint;
a:array[0..200000+10] of longint;
procedure init;
begin
end;
procedure terminate;
begin
close(input);
close(output);
halt;
end;
procedure readdata;
var
i,x:longint;
begin
fillchar(a,sizeof(a),0);
read(n);
for i:=1 to n do
begin
readln(x);
inc(a[x]);
end;
end;
procedure work;
var
i:longint;
begin
for i:=1 to 200000+1 do
if a[i]<>0 then
begin
write(i,' ');
writeln(a[i]);
end;
end;
begin
init;
readdata;
work;
terminate;
end.
求解Why。。