HDU 5781 ATM Mechine 期望dp】的更多相关文章

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5781 ATM Mechine Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描述 Alice is going to take all her savings out of the ATM(Automatic Teller Machine). Alice forget how m…
ATM Mechine 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5781 Description Alice is going to take all her savings out of the ATM(Automatic Teller Machine). Alice forget how many deposit she has, and this strange ATM doesn't support query deposit. T…
ATM Mechine 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5781 Description Alice is going to take all her savings out of the ATM(Automatic Teller Machine). Alice forget how many deposit she has, and this strange ATM doesn't support query deposit. T…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5781 题目大意: 一个人有[0,K]内随机的钱,每次可以随意取,但是不知道什么时候取完,取钱超过剩余额度会警告一次,最多警告不能超过W.求期望取出钱的次数. 题目思路: [动态规划] 二分居然错了...看来二分出的答案不一定最优..起码第三个样例过不去. f[i][j]表示钱在[0,i]区间内,警告次数不超过j的期望取钱次数.那么取一次钱k相当于把钱分成两块,[0,k]和[k+1,i],即[0,k…
题目大意:某个未知整数x等概率的分布在[0,k]中.每次你都可以从这个整数中减去一个任意整数y,如果x>=y,那么x=x-y,操作次数累计加1:否则,将会受到一次错误提示.当错误提示超过w次,将会对你的人生产生影响.现在,你的任务是将x逐步变为0,求最少操作次数的期望值. 题目分析:概率DP求期望.定义状态dp(k,w)表示整数分布在[0,k],错误提示次数上限为w时的最少操作次数的期望. 则dp(k,w)=min(p1*dp(k-y,w)+p2*(y-1,w-1))+1,其中p1.p2分别为k…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4405 Aeroplane chess Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) 问题描述 Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz s…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3853 题意: 有一个n*m的网格. 给出在每个格子时:留在原地.向右走一格,向下走一格的概率. 每走一格会消耗2点体力. 问你从(1,1)到达终点(n,m)消耗体力的期望. 题解: 表示状态: dp[i][j] = rest steps(剩余路程花费体力的期望) i,j:现在的位置 找出答案: ans = dp[0][0] 如何转移: 期望dp的套路:考虑子期望... now: dp[i][j] 能…
2019 杭电多校 7 1011 题目链接:HDU 6656 比赛链接:2019 Multi-University Training Contest 7 Problem Description Cuber QQ always envies those Kejin players, who pay a lot of RMB to get a higher level in the game. So he worked so hard that you are now the game design…
题意:有N(1<=N<=20)张卡片,每包中含有这些卡片的概率,每包至多一张卡片,可能没有卡片.求需要买多少包才能拿到所以的N张卡片,求次数的期望. 析:期望DP,是很容易看出来的,然后由于得到每张卡片的状态不知道,所以用状态压缩,dp[i] 表示这个状态时,要全部收齐卡片的期望. 由于有可能是什么也没有,所以我们要特殊判断一下.然后就和剩下的就简单了. 另一个方法就是状态压缩+容斥,同样每个状态表示收集的状态,由于每张卡都是独立,所以,每个卡片的期望就是1.0/p,然后要做的就是要去重,既然…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4336 Card Collector Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) 问题描述 In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that,…