POJ 1458 Common Subsequence——LCS
来源:互联网 发布:蚌埠市人社局新域名 编辑:程序博客网 时间:2024/06/05 16:18
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;const int maxn = 5000;char str1[maxn], str2[maxn];int n, m, dp[maxn][maxn];int main() { while (~scanf("%s %s", str1 + 1, str2 + 1)) { n = strlen(str1 + 1), m = strlen(str2 + 1); dp[0][0] = dp[0][1] = dp[1][0] = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (str1[i] == str2[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[n][m]); } return 0;}
阅读全文
1 0
- POJ 1458 Common Subsequence——LCS
- Poj 1458 Common Subsequence(LCS)
- POJ 1458 Common Subsequence(lcs)
- POJ 1458--Common Subsequence【LCS】
- POJ - 1458 - Common Subsequence (LCS)
- poj 1458 Common Subsequence【LCS】
- POJ 1458 Common Subsequence(LCS)
- poj-1458-Common Subsequence(LCS)
- POJ 1458Common Subsequence(LCS)
- POJ 1458 - Common Subsequence(LCS)
- poj 1458 Common Subsequence LCS
- POJ 1458 Common Subsequence DP(LCS)
- POJ 1458 Common Subsequence (DP,LCS)
- POJ 1458 Common Subsequence (zoj 1733 ) LCS
- hdu 1159 && poj 1458 Common Subsequence (LCS)
- poj 1458 Common Subsequence --- LCS模板
- 【DP|LCS】POJ-1458 Common Subsequence
- poj 1458 Common Subsequence(LCS)
- 关于RMI 实现步骤
- 计算两点经纬度的距离
- 快速梯度下降法-SAGA
- Java 序列化的高级认识
- HyperLPR车牌识别技术算法之基于方向纹理场进行快速车牌(文字)校正
- POJ 1458 Common Subsequence——LCS
- 神经网络权重初始化问题
- C++ 拷贝构造函数
- 使用tornado让你的请求异步非阻塞
- 树的遍历
- Django 设置 session 过期时间
- HDU5738 Eureka(计数)
- thinkphp5.0部署在nginx服务器的一些疑难杂症
- 10.0.2.15ip地址——VirtualBox安装Lunix系统ip地址的问题