讨论 / 跪求第十个测试数据
863671241 2010-08-11 03:36:00
点我顶贴 收藏 删除
跪求第十个测试数据,到底哪错啦

查看状态 Show Status

题目:争分

状态: Unaccepted

测评机: Xeost[5]

得分: 90分

提交日期: 2010-7-18 23:42:00

有效耗时: 1687毫秒

测试结果1: 通过本测试点|有效耗时156ms

测试结果2: 通过本测试点|有效耗时156ms

测试结果3: 通过本测试点|有效耗时156ms

测试结果4: 通过本测试点|有效耗时172ms

测试结果5: 通过本测试点|有效耗时219ms

测试结果6: 通过本测试点|有效耗时219ms

测试结果7: 通过本测试点|有效耗时203ms

测试结果8: 通过本测试点|有效耗时219ms

测试结果9: 通过本测试点|有效耗时187ms

测试结果10: 测试结果错误.错误结果为:CYtMTUyl0chGyt.........

var

n,i,j,x:longint;

a,b:array[1..5000]of ansistring;

function zhenli(p,q:string):boolean;

begin

if p=q then exit(false);

if length(p)<length(q) then exit(false);

if length(p)>length(q) then exit(true);

if length(p)=length(q) then if p>q then exit(true) else exit(false);

end;

procedure sort(l,r:longint);

var i,j:longint;

x,y:string;

begin

i:=l;j:=r;x:=b[(l+r)div 2];

repeat

while zhenli(b[i],x) do inc(i);

while zhenli(x,b[j]) do dec(j);

if i<=j then

begin

y:=a[i];

a[i]:=a[j];

a[j]:=y;

y:=b[i];b[i]:=b[j];b[j]:=y;

inc(i);

dec(j);

end;

until i>j;

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

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

end;

begin

readln(n);

for i:=1 to n do begin

readln(a[i]);

readln(b[i]);

while b[i][1]='0' do delete(b[1],1,1);

end;

sort(1,n);

for i:=1 to n do

writeln(a[i]);

readln;

readln;

end.

如果我的程序有漏洞,还望大牛拔刀相助

#1 863671241@2010-07-18 08:49:00
回复 删除
对不起上面的发错了,多写了一行语句,请大家看这个吧

var

n,i,j,x:longint;

a,b:array[1..5000]of ansistring;

function zhenli(p,q:string):boolean;

begin

if p=q then exit(false);

if length(p)<length(q) then exit(false);

if length(p)>length(q) then exit(true);

if length(p)=length(q) then if p>q then exit(true) else exit(false);

end;

procedure sort(l,r:longint);

var i,j:longint;

x,y:string;

begin

i:=l;j:=r;x:=b[(l+r)div 2];

repeat

while zhenli(b[i],x) do inc(i);

while zhenli(x,b[j]) do dec(j);

if i<=j then

begin

y:=a[i];

a[i]:=a[j];

a[j]:=y;

y:=b[i];b[i]:=b[j];b[j]:=y;

inc(i);

dec(j);

end;

until i>j;

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

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

end;

begin

readln(n);

for i:=1 to n do begin

readln(a[i]);

readln(b[i]);

end;

sort(1,n);

for i:=1 to n do

writeln(a[i]);

readln;

readln;

end.

#2 863671241@2010-07-18 09:14:00
回复 删除
终于过了,呵呵,没有考虑前导0的问题,把程序贴出来,供大牛BS

var

n,i,j,x,l:longint;

a,b:array[1..5000]of ansistring;

function zhenli(p,q:string):boolean;

begin

if p=q then exit(false);

if length(p)<length(q) then exit(false);

if length(p)>length(q) then exit(true);

if length(p)=length(q) then if p>q then exit(true) else exit(false);

end;

procedure sort(l,r:longint);

var i,j:longint;

x,y,t:string;

begin

i:=l;j:=r;x:=a[(i+j)div 2];y:=b[(i+j)div 2];

repeat

while zhenli(b[i],y) or((b[i]=y) and zhenli(x,a[i])) do inc(i);

while zhenli(y,b[j]) or((b[j]=y) and zhenli(a[j],x)) do dec(j);

if i<=j then

begin

t:=a[i];

a[i]:=a[j];

a[j]:=t;

t:=b[i];b[i]:=b[j];b[j]:=t;

inc(i);

dec(j);

end;

until i>j;

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

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

end;

begin

readln(n);

for i:=1 to n do begin

readln(a[i]);

readln(b[i]);

while b[i][1]='0' do

delete(b[i],1,1);

end;

sort(1,n);

for i:=1 to n do

writeln(a[i]);

readln;

readln;

end.

#3 hc199581@2010-08-11 03:36:00
回复 删除
[color=red]自娱自乐帖……

查看更多回复
提交回复