HDU 2955 Robberies 背包概率DP】的更多相关文章

A - Robberies Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2955 Appoint description: Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usu…
题意:给出规定的最高被抓概率m,银行数量n,然后给出每个银行被抓概率和钱,问你不超过m最多能拿多少钱 思路:一道好像能直接01背包的题,但是有些不同.按照以往的逻辑,dp[i]都是代表i代价能拿的最高价值,但是这里的代价是小数,显然不能这么做.还有,被抓概率显然不能直接相加,也不能相乘(越乘越小),这里就需要一些转化.我们把被抓概率转化为逃跑概率也就是1-被抓,那么逃跑概率就能直接相乘了.dp[i]代表拿到i价值的最大逃跑概率,这样又变成了01背包.最后求逃跑概率大于等于1-m的最大的钱. 代码…
Robberies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22658    Accepted Submission(s): 8358 Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that…
Robberies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12161    Accepted Submission(s): 4527 Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that…
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=2955 题目: Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decide…
11年北京现场赛的题目.概率DP. 公式化简起来比较困难....而且就算结果做出来了,没有考虑特殊情况照样会WA到死的.... 去参加区域赛一定要考虑到各种情况.   像概率dp,公式推出来就很容易写出来了. /* HDU 4098 题意:有n个人排队等着在官网上激活游戏.Tomato排在第m个. 对于队列中的第一个人.有一下情况: 1.激活失败,留在队列中等待下一次激活(概率为p1) 2.失去连接,出队列,然后排在队列的最后(概率为p2) 3.激活成功,离开队列(概率为p3) 4.服务器瘫痪,…
题意:你从0开始,要跳到 n 这个位置,如果当前位置是一个飞行点,那么可以跳过去,要不然就只能掷骰子,问你要掷的次数数学期望,到达或者超过n. 析:概率DP,dp[i] 表示从 i  这个位置到达 n 要掷的次数的数学期望.然后每次掷的数就是1-6,概率都相等为1/6,再特殊标记一下飞行点,那么就容易写过了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #in…
Walk I used to think I could be anything, but now I know that I couldn't do anything. So I started traveling. The nation looks like a connected bidirectional graph, and I am randomly walking on it. It means when I am at node i, I will travel to an ad…
/*Robberies Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13854 Accepted Submission(s): 5111 Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the…
题意: 小偷去抢银行,他母亲很担心. 他母亲希望他被抓的概率真不超过P.小偷打算去抢N个银行,每个银行有两个值Mi.Pi,Mi:抢第i个银行所获得的财产 Pi:抢第i个银行被抓的概率 求最多能抢得多少财产. 思路: 由于概率不是整数,所以不能将其作为背包容量.继续观察,发现Mi是整数,调整思路可发现,可以将财产作为背包容量,求一定财产内的被抓的最小概率.这样只需要判断这个概率是否小于等于P即可. 代码: double P; int N; int m[105]; double p[105]; do…