讨论 / 这算什么...
420988824 2008-12-06 07:35:00
点我顶贴 收藏 删除
题目编号:164-最长公共子串 查看该题

状态: Unaccepted

测评机: Xeost[5]

得分: 90分

提交日期: 2008-12-2 12:56:00

有效耗时: 985毫秒

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

测试结果2: 测试结果错误.错误结果为:DCM

正确结果应为:F

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

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

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

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

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

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

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

测试结果10: 通过本测试点|有效耗时47:ms

哪位大牛来看看...

为什么就第二个点不对......

这算什么..-_-!

源程序

program rq164;

var

s1,s2:ansistring;

len,i,j,max,ii,jj:integer;

f:array[0..1000,0..1000]of integer;

begin

readln(s1);

readln(s2);

len:=length(s1);

for i:=1 to len do

for j:=1 to len do

begin

if s1[i]=s2[j]

then begin

if s1[i-1]=s2[j-1]

then

begin

f[i,j]:=f[i-1,j-1]+1;

if f[i,j]>max

then begin

max:=f[i,j];

ii:=i;

jj:=j;

end;

end

else f[i,j]:=1;

end;

end;

for i:=ii-max+1 to ii do

write(s1[i]);

end.

#1 shuizilong96@2008-12-02 06:26:00
回复 删除
var

a,b,ls1,ls2,out:ansistring;

l1,l2,ml,asd:integer;

f:array[1..1000,1..1000] of integer;

fa:array[1..1000] of integer;

i,j,k:integer;

procedure try;

begin

for j:=1 to l2-i+1 do

if j>ml then

begin

ls1:=copy(a,i,j);

for k:=1 to l2-j+1 do

begin

ls2:=copy(b,k,j);

if (ls1=ls2) and (j>ml) then

begin

ml:=j;

out:=ls1;

end;

end;

if ls1<>out then exit;

end;

end;

begin

readln(a);

readln(b);

l1:=length(a);

l2:=length(b);

for i:=1 to l1 do try;

asd:=l1;

writeln(out);

end.

#2 420988824@2008-12-02 21:12:00
回复 删除
啊..点错了...

这怎么是最佳解呢!!!

发来个程序也看不懂..也没说错的原因!!!

郁闷ING(╰_╯)#

我可爱的积分...

#3 shuizilong96@2008-12-06 07:35:00
回复 删除
那就对不起了,我看不明白你的。。
查看更多回复
提交回复