最长公共子序列

TimeLimit:1000MS  MemoryLimit:10MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

 给定两个序列X和Y,求X和Y的最大长度公共子序列的长度。

一个序列的子序列,定义如下,选取一组严格递增的下标<i1,i2,i3,i4,……im>

则这些上标上的元素构成的新序列就是原序列的子序列,

比如序列 X = < a, b, c, f, b, c > ,选取下标 < 1, 2, 4, 6 >.后得到的序列Z=<a,b,f,c>就是X的子序列之一


Input

The program input is from the std input. Each data set in the input contains two strings representing the given sequences. The sequences are separated by any number of white spaces. The input data are correct.

字符串长度小于等于1000

Output
For each set of data the program prints on the standard output the length of the maximum-length common subsequence from the beginning of a separate line.
SampleInput
abcfbc         abfcab
programming    contest 
abcd           mnp
SampleOutput
4
2
0
Submit
题目统计信息详细
总AC数287
通过人数193
尝试人数199
总提交量521
AC率37.04%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: