定义dp[i][j]为a中前i个与b中前j个能匹配的最大长度
当 a[i] == b[j] 时,答案来自 dp[i - 1][j - 1] + 1
否则,来自dp[i - 1][j]与dp[i][j-1]中较大一个
for(rint i = 1;i <= n; ++i) { for(rint j = 1;j <= m; ++j) { if(a[i] == b[j]) dp[i][j] = dp[i - 1][j - 1] + 1; else dp[i][j] = max(dp[i - 1][j],dp[i][j - 1]); } }