HDU 1158 Common Subsequence
来源:互联网 发布:在线编程app更新 编辑:程序博客网 时间:2024/05/16 07:43
/* Coder: Shawn_Xue Date: 2015.4.4 Result: AC*/#include <iostream>#include <algorithm>#include <string>#include <cstring>using namespace std;const int maxn = 1001;string a;string b;int dp[maxn][maxn];int main(){ while(cin >> a >> b ) { memset(dp, 0, sizeof(dp)); for(int i = 1; i <= a.length(); i ++) for(int j = 1; j <= b.length(); j ++) { if(a[i-1] == b[j-1]) dp[i][j] = dp[i-1][j-1]+1; //沿着纵列加1 else dp[i][j] = max(dp[i-1][j], dp[i][j-1]); //将目前已匹配值,向纵列和横列扩散 } cout << dp[a.length()][b.length()] << endl; } return 0;}
0 0
- HDU 1158 Common Subsequence
- HDU 1158 Common Subsequence
- hdu 1159 Common Subsequence
- HDU 1159 Common Subsequence
- HDU 1159 Common Subsequence
- hdu 1159 Common Subsequence
- HDU 1159 Common Subsequence
- HDU 1159 Common Subsequence
- hdu 1159 Common Subsequence
- hdu 1008 Common Subsequence
- Common Subsequence HDU dp
- hdu 1159 Common Subsequence
- hdu 1159 Common Subsequence
- Common Subsequence hdu 1159
- HDU 1159 Common Subsequence
- HDU 1159 Common Subsequence
- hdu 1159 Common Subsequence
- hdu-Common Subsequence
- 黑马程序员——Java基础---循环
- Triangle - LeetCode
- static 关键字
- Python 3.x中的urllib的改动
- struts.xml
- HDU 1158 Common Subsequence
- 单线性链表的创建,遍历以及增删查改
- hdoj 1196 Lowest Bit
- 第4周项目1三角形类的构造函数(3)
- C语言 编写函数实现内存重叠拷贝,不允许调用memmove函数
- ISSYS_MODIFIABLE 返回false
- opencv人脸识别总结三
- POJ1163 The Triangle
- springmvc No Hibernate Session bound to thread