poj 1458 Common Subsequence
来源:互联网 发布:ios11数据开关怎么设置 编辑:程序博客网 时间:2024/06/11 20:46
简单的动态规划
#include <iostream>#include <string>using namespace std;int dp[500][500];string s,t;int max(int a, int b){ return a>=b?a:b;}int lcs(){ int i,j; for(i=1;i<=s.size();i++){ for(j=1;j<=t.size();j++){ if(s[i-1]==t[j-1]){ dp[i][j]=dp[i-1][j-1]+1; } else{ dp[i][j]=max(dp[i-1][j],dp[i][j-1]); } } } return dp[s.size()][t.size()];}int main(){ while(cin>>s>>t){ memset(dp,0,sizeof(dp)); cout<<lcs()<<endl; } system("PAUSE"); return 0;}
- Common Subsequence--poj--1458
- poj 1458 Common Subsequence
- poj 1458 Common Subsequence
- Poj 1458 Common Subsequence
- POJ 1458 Common Subsequence
- poj 1458 Common Subsequence
- poj 1458 Common Subsequence
- POJ 1458 Common Subsequence
- poj 1458 Common Subsequence
- POJ-1458-Common Subsequence
- POJ 1458 Common Subsequence
- poj 1458 Common Subsequence
- POJ 1458 Common Subsequence
- poj 1458 Common Subsequence
- POJ 1458 Common Subsequence
- POJ 1458 Common Subsequence
- POJ 1458 Common Subsequence
- poj 1458 Common Subsequence
- Oracle materizlized view Study (2)
- You’re given an array containing both positive and negative integers and required to find the sub-a
- A new common sub-strings problem(后缀数组,求第K小公共子串)
- SD初始化过程以及Cmd解析
- CentOS字符编码方式
- poj 1458 Common Subsequence
- 黑马程序员-----java基础四(之封装特性)
- poj 2533 Longest Ordered Subsequence
- MFC学习之 Codejock Xtreme Toolkit 使用例子
- oracle创建微博所需要(练习)
- 黑马程序员-----java基础③(数组及循环练习)
- Create Your Own Search Engine with Python 用python创建你自己的搜索引擎(三)
- Android 重新编译资源文件
- 判断两个nsstring类型的字符串不相等的代码怎么写