51nod 1092【区间dp】
2016-08-31 23:29
260 查看
思路:
简单的区间dp,从小区间到大区间,随便写。
还有一种是那啥,n-LCS。。。具体不说了,赶时间)))= =、
简单的区间dp,从小区间到大区间,随便写。
还有一种是那啥,n-LCS。。。具体不说了,赶时间)))= =、
#include <stdio.h> #include <string.h> #include <iostream> using namespace std; typedef long long LL; const int N=1e3+10; char s ; int dp ; int main() { int n; scanf("%s",s+1); n=strlen(s+1); memset(dp,0,sizeof(dp)); for(int len=1;len<n;len++) for(int j=1;j<=n;j++) { if(s[j]==s[j+len]) dp[j][j+len]=dp[j+1][j+len-1]; else dp[j][j+len]=min(dp[j+1][j+len],dp[j][j+len-1])+1; } printf("%d\n",dp[1] ); return 0; }
相关文章推荐
- 51Nod - 1092 区间dp
- 51nod 1092 回文字符串 LCS 或 区间dp
- 【51nod 1092】 回文字符串(区间DP)
- 51nod 1092 回文字符串(区间dp)
- 51Nod - 1021 区间dp
- 51nod 1021 石子归并(区间dp 详细解释)
- 51Nod - 1021 石子归并 区间DP入门-分析
- 51nod 1092 回文字符串 dp问题
- 1021区间dp-51nod
- 51Nod 1092 回文字符串(LCS跟dp)
- 51nod 1052 最大M子段和 (区间dp)
- 经典问题二.【区间dp】石子归并 51nod 1021
- 51Nod - 1021石子归并(区间DP)
- 51nod 1092 回文字符串 (dp)
- 51nod 1092 回文字符串 【巧用 dp】
- 51Nod - 1522 区间dp
- 51nod 1092 回文字符串 (LCS_DP)
- 【51nod】1022 石子归并V2 区间DP
- 51nod 1021 石子归并(区间dp)
- 51nod 1021【区间DP】