hdu 1159 Common Subsequence
来源:互联网 发布:股票盈亏记账软件 编辑:程序博客网 时间:2024/05/21 21:45
http://acm.hdu.edu.cn/showproblem.php?pid=1159
最长公共子序列不解释
代码:
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>#include <iostream>#include <algorithm>#include <map>#include <set>#include <queue>using namespace std;char word1[1005];char word2[1005];int dp[1005][1005];int main(){ while(scanf("%s%s",word1+1,word2+1)==2) { memset(dp,0,sizeof(dp)); int len1=strlen(word1+1); int len2=strlen(word2+1); for(int i=1;i<=len1;i++) for(int j=1;j<=len2;j++) { if(word1[i]==word2[j]) dp[i][j]=dp[i-1][j-1]+1; else dp[i][j]=max(dp[i-1][j],dp[i][j-1]); } printf("%d\n",dp[len1][len2]); }}
- 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
- 用javascript验证表单数据正则表达式汇总
- 输出2-1000的所有完数
- odex转成dex
- 设置投影模式+Nehe第20课掩膜
- PL/SQL常用的字符串函数
- hdu 1159 Common Subsequence
- 第一次实习面试
- 使用QT布局管理器
- 浅析Java中的深拷贝与浅拷贝
- DoJo Tree第一次加载选中行的背景色被截断?
- 构造函数初始化列表
- delphi wordapplication控件
- delphi wordapplication控件
- 保存Delphi中的环境设置中的library path