[算法] poj 3356 字符串的距离 AGTC
来源:互联网 发布:unity3d java服务器 编辑:程序博客网 时间:2024/05/19 23:16
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int N = 1010;int dp[N][N];char a[N], b[N];int n, m;int get_min(int x, int y, int z) {return min(min(x, y), z);}int main() {while(cin >> n) {scanf("%s", a+1);scanf("%d%s", &m, b+1);for(int i = 0; i <= n; i++) {dp[i][0] = i;}for(int i = 0; i <= m; i++) {dp[0][i] = i;}for(int i = 1; i <= n; i++) {for(int j = 1; j <= m; j++) {if(a[i] == b[j]) {dp[i][j] = dp[i-1][j-1];}else dp[i][j] = min(min(dp[i-1][j], dp[i][j-1]), dp[i-1][j-1]) + 1;}}cout << dp[n][m] << endl;}return 0;}
- [算法] poj 3356 字符串的距离 AGTC
- poj 3356 AGTC 【编辑距离】
- POJ-3356 AGTC(编辑距离)
- POJ-3356(编辑距离)(AGTC)
- poj 3356 AGTC(dp,最小编辑距离)
- POJ 3356 AGTC (编辑距离 DP)
- POJ 3356 AGTC(最小编辑距离)
- POJ 3356 AGTC (最小编辑距离)
- POJ 3356 AGTC 最短编辑距离
- POJ 3356 AGTC 最短编辑距离
- POJ 3356 AGTC(算法导论15-5编辑距离) 经典dp
- POJ 3356 AGTC(最短编辑距离 DP)
- poj 3356 AGTC(dp 求最短编辑距离)
- poj 3356 AGTC(动态规划:最短编辑距离)
- POJ 3356 AGTC 【最短编辑距离,经典DP】
- POJ 3356 AGTC(经典DP最短编辑距离)
- poj 3356 AGTC
- poj 3356 AGTC
- JAVA和C++高低位转换
- cat和EOF
- C# 枚举 Win32_LogicalDisk 类的所有实例,并显示每个实例的 DeviceID 值
- stagefright,OpenMax框架
- 数据结构学习笔记之三(二叉树)
- [算法] poj 3356 字符串的距离 AGTC
- multiple definition of 问题解决方法
- netfilter与用户空间通信二法
- bash 初探与PATH 详解
- 操作系统小结
- golange 错误如下 Resource interpreted as Script but transferred with MIME type text
- Linux环境下PostgreSQL与PostGIS的安装与配置
- 多线程常用语法
- 新手写OFBiz的HelloWorld