比赛 noip_6 评测结果 AAAAATTTTT
题目名称 词链 最终得分 50
用户昵称 WaterFire 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-08 19:29:57
显示代码纯文本
program waterfire;
const
fin='link.in';
fout='link.out';
var
n,i,j:longint;
ss:array[0..10000] of string;
ans:array[0..10000] of longint;
max:longint;
f,g:text;

BEGIN
max:=-maxint;
assign(f,fin);reset(f);
assign(g,fout);rewrite(g);
readln(f,n);
for i:=1 to n do begin
readln(f,ss[i]);
ans[i]:=1;
end;
  for i:=n downto 1 do
    for j:=i-1 downto 1 do
      if (pos(ss[j],ss[i])<>0)and(ans[i]>=ans[j])
       then inc(ans[j]);
  for i:=1 to n do
  if  ans[i]>max then max:=ans[i];
write(g,max);
close(f);close(g);
end.