2080最長公共子串行問題(DP)

2022-07-11 06:57:13 字數 437 閱讀 7251

給定兩個序列 x= 和 y=,找出x和y的最長公共子串行。

輸入資料有多組,每組有兩行 ,每行為乙個長度不超過500的字串(輸入全是大寫英文本母(a,z)),表示序列x和y。

每組輸出一行,表示所求得的最長公共子串行的長度,若不存在公共子串行,則輸出0。

input

abcbdab

bdcaba

output
4
1 #include 2 #include 3 #include 

4 #include

5#define inf 0x3f3f3f3f

6using

namespace

std;78

intmain()925

}26 cout << dp[len1][len2] <28return0;

29 }

SDUT 2080最長公共子串行問題

time limit 1000ms memory limit 65536kb submit statistic discuss problem description 給定兩個序列x input 輸入資料有多組,每組有兩行 每行為乙個長度不超過500的字串 輸入全是大寫英文本母 a,z 表示序列x和...

SDUT 2080 最長公共子串行問題

最長公共子串行問題 time limit 1000 ms memory limit 65536 kib problem description 給定兩個序列 x 和 y 找出x和y的最長公共子串行。input 輸入資料有多組,每組有兩行 每行為乙個長度不超過500的字串 輸入全是大寫英文本母 a,z...

dp 最長公共子串行問題

最長公共子串行問題 time limit 1000 ms memory limit 65536 kib problem description 給定兩個序列 x 和 y 找出x和y的最長公共子串行。input 輸入資料有多組,每組有兩行 每行為乙個長度不超過500的字串 輸入全是大寫英文本母 a,z...