zoj 1027 Human Gene Functions
来源:互联网 发布:网络传播与策划 刘芸 编辑:程序博客网 时间:2024/04/27 02:29
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1027本题是一道典型的DP问题,刚开始学习DP问题,不怎么会,看了别人解题报告..T_T定义函数f(i,j),(0<=i<=m,0<=j<=n):表示字符串X1...Xi与字符串Y1...Yi的最大匹配值。则f(m,n)就是所求的结果。那么该如何用DP求f(i,j)呢?分三种情况:1.让Xi与‘-’进行匹配:则f1(i,j) = f(i-1,j) + value(Xi,'-');2.让Yj与‘-’进行匹配:则f2(i,j) = f(i,j-1) + value(Yj,'-');3.让Xi与Yj进行匹配:则f3(i,j) = f(i-1,j-1) + value(Xi,Yj);以上三种情况取最大值,就是f(i,j)。那么下面就是初始值的设定问题了:f(0,0) = 0;//很容易忘记..f(i,0) = f(i-1,0) + value(x[i],'-'); 0<i<=m
f(0,j) = f(0,j-1) + value(y[j],'-'); 0<j<=n
晒晒我综合大家以后的代码:
- ZOJ-1027-Human Gene Functions
- zoj 1027 Human Gene Functions
- ZOJ 1027 Human Gene Functions
- ZOJ 1027 Human Gene Functions
- Zoj 1027 Human Gene Functions
- zoj 1027 Human Gene Functions
- zoj 1027 - Human Gene Functions
- ZOJ 1027 Human Gene Functions (DP)
- HDU 1080 || ZOJ 1027 Human Gene Functions
- zoj 1027 DP Human Gene Functions
- ZOJ 1027 Human Gene Functions(dp)
- ZOJ 1027 Human Gene Functions
- ZOJ 1027 Human Gene Functions(最长公共子序列)
- ZJU 1027 Human Gene Functions
- zju 1027-Human Gene Functions
- zoj1027 Human Gene Functions
- 1080 Human Gene Functions
- PKU1080 Human Gene Functions
- zoj 1025 Wooden Sticks
- VSS(2005)中如何强行签入文件
- Example of Makefile
- Backtrack 4: Crack WPA2
- 如何阅读linux内核源码
- zoj 1027 Human Gene Functions
- Web dynpro的SELECT-OPTIONS做成方法
- 构建form,保护隐私数据传递给本身,并且通过pre_init改变theme
- 内存管理-page初始化,分配与回收
- Larbin learning (1)——How to compile and use larbin
- 修改host访问Google Chrome官方扩展页
- 两道面试题
- 存货收发存应用实例
- #include的用法