hdu1159-Common Subsequence
来源:互联网 发布:竞彩足球数据 编辑:程序博客网 时间:2024/05/16 07:34
Common Subsequence
dp之最长公共子序列
// File Name: hdu1159.cpp// Author: rudolf// Created Time: 2013年04月25日 星期四 12时12分33秒#include<vector>#include<list>#include<map>#include<set>#include<deque>#include<stack>#include<bitset>#include<algorithm>#include<functional>#include<numeric>#include<utility>#include<sstream>#include<iostream>#include<iomanip>#include<cstdio>#include<cmath>#include<cstdlib>#include<cstring>#include<ctime>#include<string>using namespace std;const int maxn=1005;int dp[maxn][maxn];int main(){int len1,len2;string str1,str2;while(cin>>str1>>str2){memset(dp,0,sizeof(dp));for(int i=0;i<str1.length();i++)for(int j=0;j<str2.length();j++){if(str1[i]==str2[j])dp[i+1][j+1]=dp[i][j]+1;elsedp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);}cout<<dp[str1.length()][str2.length()]<<endl;}return 0;}
- HDU1159 Common Subsequence (LCS)
- HDU1159--Common Subsequence
- hdu1159-Common Subsequence
- hdu1159 Common Subsequence
- HDU1159 Common Subsequence
- HDU1159:Common Subsequence
- hdu1159 Common Subsequence DP
- HDU1159 Common Subsequence
- HDU1159,Common Subsequence,toCharArray()
- HDU1159:Common Subsequence(LCS)
- HDU1159 Common Subsequence
- hdu1159 Common Subsequence(LCS)
- HDU1159---Common Subsequence
- hdu1159 Common Subsequence
- hdu1159 Common Subsequence--DP
- HDU1159:Common Subsequence
- [HDU1159]-Common Subsequence
- HDU1159-Common Subsequence
- Button按钮释放时的事件
- BF_KMP字符串匹配
- Android 拨打电话
- 本地登录环境的获取文件的命令使用
- struts2+jsp+jquery+Jcrop实现图片裁剪并上传
- hdu1159-Common Subsequence
- Android 通过ACTION_CALL 动作拨打电话
- 几种常用的排序算法的分析及java实现(希尔排序,堆排序,归并排序,快速排序,选择排序,插入排序,冒泡排序)
- AE与AO的区别
- Python内置的字符串处理函数整理
- 1080P和720P电影的分辨率到底是多少
- 如何提高表达能力和逻辑思维能力
- 搬到csdn博客了,呵呵
- ArcGis Engine(AE)开发环境的搭建