POJ 1080( LCS变形)】的更多相关文章

Human Gene Functions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3008    Accepted Submission(s): 1701 Problem Description It is well known that a human gene can be considered as a sequence,…
题目链接: http://poj.org/problem?id=1080 Human Gene Functions Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 20430   Accepted: 11396 Description It is well known that a human gene can be considered as a sequence, consisting of four nucleoti…
Human Gene Functions 题意: LCS: 设dp[i][j]为前i,j的最长公共序列长度: dp[i][j] = dp[i-1][j-1]+1;(a[i] == b[j]) dp[i][j] = max(dp[i][j-1],dp[i-1][j]); 边界:dp[0][j] = 0(j<b.size) ,dp[i][0] = 0(i< a.size); LCS变形: 设dp[i][j]为前i,j的最大价值: value(x, y)为比较价值: dp[i][j] = max(d…
Human Gene Functions Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19376   Accepted: 10815 Description It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four…
http://poj.org/problem?id=1080 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=27 /* zoj 1027 poj 1080 思路: 三种状态,取最大值: s1[i]和s2[j]配 :dp[i-1][j-1]+cost[my[s1[i]]][my[s2[j]]]; s1[i]和'-' 配: dp[i-1][j]+cost[my[s1[i]]][my['-']]; s2[j]和'-' 配: dp[…
[POJ 1080] Human Gene Functions 相似于最长公共子序列的做法 dp[i][j]表示 str1[i]相应str2[j]时的最大得分 转移方程为 dp[i][j]=max(dp[i-1][j-1]+score[str1[i]][str2[j]], max(dp[i-1][j]+score[str1[i]]['-'],dp[i][j-1]+score['-'][str2[j]]) ) 注意初始化0下标就好 代码例如以下: #include <iostream> #inc…
Color Length(UVA-1625)(DP LCS变形) 题目大意 输入两个长度分别为n,m(<5000)的颜色序列.要求按顺序合成同一个序列,即每次可以把一个序列开头的颜色放到新序列的尾部. https://odzkskevi.qnssl.com/a68cbd3e27f46b4f02ea12b7b1a1abca 然后产生的新序列中,对于每一个颜色c,都有出现的位置,L(c)表示最小位置和最大位置之差,求L(c)总和最小的新序列. 分析 LCS 是公共上升子序列,在动态转移的过程中,考虑…
题目链接:http://poj.org/problem?id=1080 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; ; const int INF = 0x3f3f3f; int dp[maxn][maxn]; int A[maxn],B[maxn]; ][] = { {, , , , , }, {,,-,-,-,…
Human Gene Functions Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19573   Accepted: 10919 Description It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four…
Description It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in identifying human genes and determining their…