题目链接 基础的最长公共子序列 #include <bits/stdc++.h> using namespace std; ; char c[maxn],d[maxn]; int dp[maxn][maxn]; int main() { while(scanf("%s%s",c,d)!=EOF) { memset(dp,,sizeof(dp)); int n=strlen(c); int m=strlen(d); ;i<n;i++) ;j<m;j++) if(c…
HDU 1159 题目大意:给定两个字符串,求他们的最长公共子序列的长度 解题思路:设字符串 a = "a0,a1,a2,a3...am-1"(长度为m), b = "b0, b1, b2, b3 ... bn-1"(长度为n), 它们的最长公共子序列为c = "c0, c1, c2, ... ck-1",长度为k, dp[i][j]定义为子串 "a0,a1,...,ai-1" 和 子串"b0,b1,...,bj-1…
HDU 1159 Common Subsequence 最长公共子序列 题意 给你两个字符串,求出这两个字符串的最长公共子序列,这里的子序列不一定是连续的,只要满足前后关系就可以. 解题思路 这个当然要使用动态规划了. 这里\(dp[i][j]\)代表第一个串的前\(i\)个字符和第二个串的前\(j\)个字符中最长的公共子序列的最长长度,递推关系如下: \[ d[i][j]= \begin{cases} dp[i-1][j-1]+1 & \text{if} &str1[i]==str2[j…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1159 Common Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 47676    Accepted Submission(s): 21890 Problem Description A subsequence of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159 Common Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25416    Accepted Submission(s): 11276 Problem Description A subsequence of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159 Common Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18201    Accepted Submission(s): 7697 Problem Description A subsequence of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159 Common Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 37551    Accepted Submission(s): 17206 Problem Description A subsequence of…
Common Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 24489    Accepted Submission(s): 10823 Problem Description A subsequence of a given sequence is the given sequence with some e…
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1159 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28195#problem/A Common Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17621…
Common Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 39559    Accepted Submission(s): 18178 Problem Description A subsequence of a given sequence is the given sequence with some el…