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

题目链接: 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…
// 多校5 1001 HDU5781 ATM Mechine // http://acm.hdu.edu.cn/search.php?field=problem&key=2016+Multi-University+Training+Contest+5&source=1&searchmode=source // 记忆化搜索 // 每次二分,决策最优,所以最多查询11次 // dp[i][j] 当前能确定i元情况下,还能被警告j次 // 下次取k,实际剩余t // dp[i][j]=…
ATM Mechine 本文转自:http://blog.csdn.net/queuelovestack/article/details/52096337 题意: 这题的意思还是比较费解的 Alice忘记自己在银行里存了多少钱,只记得是闭区间[0,k]内的一个整数 每次取钱,Alice会取y RMB的钱,如果余额足够则被取出,否则会被警告一次 若警告次数超过w次,Alice就会被警察抓走 在不被警察抓走的前提下,Alice采取最优策略,问期望尝试取钱多少次能够取完Alice存的所有钱 题解: 首…
题目链接: ATM Mechine Time Limit: 6000/3000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others) Problem Description Alice is going to take all her savings out of the ATM(Automatic Teller Machine). Alice forget how many deposit she has, and thi…
应该是machine 和POJ3783 Balls类型相似. 现在上界为i元,猜错次数最多为j时,开始猜测为k元,有两种情况: 1 猜中:(i - k + 1) * dp[i - k][j] 2 猜不中 k * dp[k - 1][j - 1] 两种情况的均值即为第一次猜测为k时的期望,1 <= k <= i + 1,枚举k,取最小值. 另外其实m取不到2000,由二分思想最多十几次(开始也没想到,一直不能把n^3的复杂度降下来). #include<cstdio> #includ…
题目大意:某个未知整数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>…