HDU 1159 Common Subsequence
来源:互联网 发布:装修软件 编辑:程序博客网 时间:2024/05/16 17:38
http://write.blog.csdn.net/postedit
#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>using namespace std;const int N = 1010;int dp[N][N];char s1[N],s2[N];int main(){// freopen("in.txt", "r", stdin); while(cin >> s1 >> s2){ memset(dp, 0, sizeof(dp)); int l1 = strlen(s1), l2 = strlen(s2); for(int i=0; i<l1; i++){ for(int j=0; j<l2; j++){ if(s1[i] == s2[j]) dp[i+1][j+1] = dp[i][j] + 1; else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]); } } printf("%d\n",dp[l1][l2]); } return 0;};
0 0
- 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 1159 Common Subsequence
- hdu 1159 Common Subsequence
- Common Subsequence hdu 1159
- 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 1159 Common Subsequence
- 笔试_lq
- 枚举类型的单例模式(java)
- 深入学习Objective-C(二)理解 objc 关联对象 (Associated Objects)
- 搭建SVN服务器
- UVA 10341
- HDU 1159 Common Subsequence
- 利用接口类实现对多个实现子类的初始化,并调用子类中的方法
- 关于linux的开机自运行和登陆自运行
- 记录8--ubuntu备份与还原
- 【DP】 POJ 3311 Hie with the Pie 状压 TSP问题
- 利用java/android 模拟网页表单提交。可用于爬虫和wif登录器制作
- 1013. Battle Over Cities (25)
- LeetCode Balanced Binary Tree
- 《数据结构》实验三: 栈和队列实验