讨论 / p378
jc09087 2012-01-31 03:26:00
点我顶贴 收藏 删除
别怪我没用快排,大问题是:“输出过少|用户输出数据少于标准输出的50%[标准输出2151478位|选手输出173位]”

program rq378;

var code,n,i,j,k,temp2,man:longint;

st,st2,temp1:string;

score:array[1..130000] of longint;

nme:array[1..130000] of string;

duan:array[1..15] of longint;

begin

readln(n);

for i:=1 to n do

begin

readln(st);

j:=1;

while st[j]<>' ' do

j:=j+1;

st2:='';

nme[i]:='';

for k:=1 to j-1 do

nme[i]:=nme[i]+st[k];

for k:=j+1 to length(st) do

st2:=st2+st[k];

val(st2,score[i],code);

end;

writeln('1~9 10~19 20~29 30~39 40~49 50~59 60~69 70~79 80~89 90~99 100~109 110~119 120~129 130~139 140~149');

for i:=1 to n do

if (score[i]<>150) and (score[i]<>0)

then inc(duan[(score[i] div 10)+1]);

for i:=1 to 14 do

write(duan[i],' ');

writeln(duan[15]);

for i:=1 to n-1 do

for j:=i to n do

if nme[i]>nme[j]

then begin

temp1:=nme[i];

nme[i]:=nme[j];

nme[j]:=temp1;

temp2:=score[i];

score[i]:=score[j];

score[j]:=temp2;

end;

for i:=1 to n do

writeln(nme[i],' ',score[i]);

for i:=1 to n do

if score[i]=150

then inc(man);

writeln(man);

if man=0

then writeln('No')

else for i:=1 to n do

if score[i]=150

then writeln(nme[i]);

end.

#1 407137009@2010-11-14 22:47:00
回复 删除
这题的数据如此变态,PAS语言的话什么排序都WA..

您这连快排都不用....

至于输出过少,可能是超时的原因吧

#2 达达@2012-01-31 03:26:00
回复 删除
同病相怜

我也这样

查看更多回复
提交回复