[HDU 2955]Robberies (动态规划)】的更多相关文章

题目链接: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…
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 题目: 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)…
Robberies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10526    Accepted Submission(s): 3868 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): 13854 Accepted Submission(s): 5111 Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the…
Robberies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7351    Accepted Submission(s): 2762 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…
Robberies 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 decided to work in the lucrative business of bank ro…