讨论 / 为什么有一个数据总是错误
826124073ymj 2013-04-08 21:06:00
点我顶贴 收藏 删除
type t=record

mark:string;

xh:string;

m:integer;

b:boolean;

end;

var a:array[1..130000] of t;

i,j,k,n,l,code,i9,i19,i29,i39,i49,i59,i69,i79,i89,i99,i109,i119,i129,i139,i149,full:longint;

temp:string;

jb:t;

procedure sort(r,l:longint);

var

i,j:longint;

c:ansistring;

chang:t;

begin

i:=r;

j:=l;

c:=a[random(j-i+1)+i].xh;

repeat

while a[i].xh<c do inc(i);

while a[j].xh>c do dec(j);

if not(i>j) then

begin

chang:=a[i];

a[i]:=a[j];

a[j]:=chang;

inc(i); dec(j);

end;

until i>j;

if i<l then sort(i,l);

if j>r then sort(r,j);

end;

begin

readln(n);

for i:=1 to n do

begin

readln(temp);

j:=pos(' ',temp);

a[i].xh:=copy(temp,1,j-1);

a[i].mark:=copy(temp,j+1,length(temp)-j);

val(a[i].mark,a[i].m,code);

if (a[i].m>=0) and (a[i].m<=9) then i9:=i9+1;

if (a[i].m>=10) and (a[i].m<=19) then i19:=i19+1;

if (a[i].m>=20) and (a[i].m<=29) then i29:=i29+1;

if (a[i].m>=30) and (a[i].m<=39) then i39:=i39+1;

if (a[i].m>=40) and (a[i].m<=49) then i49:=i49+1;

if (a[i].m>=50) and (a[i].m<=59) then i59:=i59+1;

if (a[i].m>=60) and (a[i].m<=69) then i69:=i69+1;

if (a[i].m>=70) and (a[i].m<=79) then i79:=i79+1;

if (a[i].m>=80) and (a[i].m<=89) then i89:=i89+1;

if (a[i].m>=90) and (a[i].m<=99) then i99:=i99+1;

if (a[i].m>=100) and (a[i].m<=109) then i109:=i109+1;

if (a[i].m>=110) and (a[i].m<=119) then i119:=i119+1;

if (a[i].m>=120) and (a[i].m<=129) then i129:=i129+1;

if (a[i].m>=130) and (a[i].m<=139) then i139:=i139+1;

if (a[i].m>=140) and (a[i].m<=149) then i149:=i149+1;

if (a[i].m=150) then

begin

full:=full+1;

a[i].b:=true;

end;

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');

writeln(i9,' ',i19,' ',i29,' ',i39,' ',i49,' ',i59,' ',i69,' ',i79,' ',i89,' ',i99,' ',i109,' ',i119,' ',i129,' ',i139,' ',i149);

sort(1,n);

for i:=1 to n do

writeln(a[i].xh,' ',a[i].m);

writeln(full);

if full=0 then writeln('No')

else for i:=1 to n do

if a[i].b=true then writeln(a[i].xh);

end.

始终有一个数据分数全是随机数

查看更多回复
提交回复