1 . Robberies (hdu 2955)】的更多相关文章

http://acm.hdu.edu.cn/showproblem.php?pid=2955 [题意] 有一个强盗要去几个银行偷盗,他既想多抢点钱,又想尽量不被抓到.已知各个银行 的金钱数和被抓的概率,以及强盗能容忍的最大被抓概率.求他最多能偷到多少钱? [思路] 01背包:每个物品代价是每个银行钱的数目,物品的价值是在该银行不被抓的概率 (1-被抓概率),背包容量是所有银行钱的总和.01背包求dp[i]表示获得i的钱不被抓的最大概率.最后从大到小枚举出 dp[i]>=(1-P)这个i就是答案了…
Robberies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18013    Accepted Submission(s): 6653 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): 10933    Accepted Submission(s): 4049 Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that…
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 decided to work in the lucrative business of bank robbery only for a short while,…
直接说题意吧.(什么网友bb了半天题都说不清楚) 给了  P  表示大于这个概率一定被抓住.则P表示被抓住的概率.N表示现在有的银行,pi表示被抓的概率嘛. 然后,就看数学了.肯定不能算被抓的概率啊.因为,如果你第一个就被抓了,后面的概率还用算吗,或则说,这样的计算不符合01 背包的特点,那么我们就想一下,作为一个背包的容量,应该是做加减法,而不是像概率那样做乘除啊.那么我们就用银行的价值作为 物体的体积,而概率(1-被抓的概率=逃跑的概率)作为物品的价值啊.为什么转化为逃跑的概率呢?因为正面肛…
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…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2955 题意是给你一个概率P,和N个银行 现在要去偷钱,在每个银行可以偷到m块钱,但是有p的概率被抓 问你被抓的概率在P以下,最多能偷多少钱. 刚开始我还在想,A银行被抓的概率是a,B银行被抓的概率是b,那么偷A和B被抓的概率是a*b.. 傻逼了- -..a*b是既被A银行抓又被B银行抓.. 所以用逃跑的概率计算 dp[i][j]代表从前i个银行里偷了j元逃跑的最大概率 代码: #include <c…
题目网址: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…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2955 思路:一开始看急了,以为概率是直接相加的,wa了无数发,这道题目给的是被抓的概率,我们应该先求出总的逃跑概率,1-逃跑概率就是最后被抓的概率,dp的话,以所有银行总金额为容量,以单个银行的金额为体积,以逃跑的概率为价值,跑01背包,最后找一下小于被抓概率的最大金额. 实现代码: #include<bits/stdc++.h> using namespace std; ; ],b[M]; int…
http://acm.hdu.edu.cn/showproblem.php?pid=2955 题意:一个抢劫犯要去抢劫银行,给出了几家银行的资金和被抓概率,要求在被抓概率不大于给出的被抓概率的情况下,计算出所能抢劫得到的最多资金. 思路:一开始把被抓概率当做背包容量来做,结果错了,很重要的一点就是逃脱概率的计算,不是简单的相加相减,而是在上一家银行抢劫时的逃脱概率再乘以这一次的逃脱概率. 举个例子: 三家银行的被抓概率为P1,P2,P3.那么去抢劫这三家银行的逃脱概率为(1-P1)*(1-P2)…