讨论 / 无语,全WA了...为啥啊..作孽啊!!!
chip 2010-10-10 11:21:00
点我顶贴 收藏 删除

{

rqnoj.378.cord

}

program cord;

type

people=record

s:string;

m:longint;

end;

var

a:array[1..130000]of people;

b:array[1..15,1..3]of longint;

c:array[1..10000]of string;

i,j,n,full:longint;

ch:char;

procedure quick(l,r:longint);

var i,j,k:longint;

m,ss:string;

begin

i:=l; j:=r;

m:=a[(i+j)div 2].s;

repeat

while a[i].s<m do inc(i);

while a[j].s>m do dec(j);

if i<=j then begin

ss:=a[i].s; k:=a[i].m;

a[i].s:=a[j].s; a[i].m:=a[j].m;

a[j].s:=ss; a[j].m:=k;

inc(i);

dec(j);

end;

until i>j;

if i<r then quick(i,r);

if j>l then quick(l,j);

end;

begin

full:=0;

for i:=1 to 15 do begin b[i,1]:=(i-1)*10; b[i,2]:=i*10-1; end;

b[1,1]:=1;

readln(n);

for i:=1 to n do begin

j:=0;

read(ch);

while ch<>' ' do begin

inc(j);

a[i].s:=a[i].s+ch;

read(ch);

end;

readln(a[i].m);

end;

quick(1,n);

for i:=1 to n do begin

if a[i].m=150 then begin inc(full); c[full]:=a[i].s; end

else begin

for j:=1 to 15 do if (a[i].m>=b[j,1])and(a[i].m<=b[j,2]) then begin inc(b[j,3]); break; end;

end;

end;

for i:=1 to 15 do write(b[i,1],'~',b[i,2],' ');writeln;

for i:=1 to 15 do write(b[i,3],' '); writeln;

for i:=1 to n do writeln(a[i].s,' ',a[i].m);

if full>0 then begin

writeln(full);

for i:=1 to full do writeln(c[i]);

end

else begin writeln('0'); writeln('No'); end;

readln;

end.

查看更多回复
提交回复