所谓概率DP大多是算期望 算期望大多是从终点往回推
分类:
其他好文 时间:
2015-02-17 12:47:44
阅读次数:
122
依然是二维的动态规划 类似于走迷宫那种 需要在算dp[i][j]的时候不断更新最大值
分类:
系统相关 时间:
2015-02-17 12:47:30
阅读次数:
214
Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is...
分类:
其他好文 时间:
2015-02-16 20:58:05
阅读次数:
180
引言背包问题作为一个经典问题在动态规划中是很基础的一个部分,而以0-1背包问题为原题,衍生出来的各类题目千变万化,解法也不同。
本文以三道背包问题的变体着手讲解,希望能够做到触类旁通。0-1背包
给定n件物品和一个背包。物品i的价值是Wi,体积为Vi,背包的容量为C。可以任意选择装入背包的物品,求装入背包中的物品最大总价值。(Vi,C均为正整数)
在选择装入背包的物品时,有这样一个隐性条件:对...
分类:
其他好文 时间:
2015-02-16 18:27:03
阅读次数:
242
1.题目描述:点击打开链接
2.解题思路:本题利用集合上的动态规划解决。定义集合s1表示恰好有一个人教的课程,集合s2表示至少有两个人教的课程。定义d(i,s1,s2)表示已经考虑了前i个人时的最小花费(人物编号从0开始)。则不难写出状态转移方程:
d(i,s1,s2)=min{d(i+1,s1',s2')+c[i],d(i+1,s1,s2)};
上式中只有当i≥m时才会考虑第二项。对于这个...
分类:
其他好文 时间:
2015-02-16 17:02:01
阅读次数:
142
由leetcode139题Word Break产生的对动态规划的一点思考。
题目要求是这样的:
Given a string s and a dictionary of words dict,determine if s can be segmented into a space-separatedsequence of one or more dictionary words.
For e...
分类:
其他好文 时间:
2015-02-16 16:59:00
阅读次数:
158
Stringsobits
Kim Schrijvers
Consider an ordered set S of strings of N (1
This set of strings is interesting because it is ordered andcontains all possible strings of length N that have L (1
Your...
分类:
其他好文 时间:
2015-02-16 15:40:40
阅读次数:
127