不是VIP会员,不能显示答案

题目解答

题目:
program t2014_4;
var
s:array[1..10000] of string; x:string;
n,i,j,k,max:integer;
begin
readln(n);
readln(s[1]);k:=1; max:=1;
for i:=2 to n do
begin
readln(x);
j:=k;
while (pos(s[j],x)=0) and (j>0) do j:=j-1;
s[j+1]:=x;
if max< j+1 then
begin
max:=j+1;
k:=k+1;
end;
end;
writeln(max);
end.
输入:
10
h
hpe
hpeh
hpehp
hpehxt
hpej
hpeju
hpejuyr
hu
hws

输出:5
考点: 0
分析: (最长子序列)
解答:
评论:
老师: 0