lightoj 1079 Just another Robbery】的更多相关文章

题目链接:https://vjudge.net/problem/LightOJ-1079 1079 - Just another Robbery    PDF (English) Statistics Forum Time Limit: 4 second(s) Memory Limit: 32 MB As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants eve…
Description As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants everything quick!) so he decided to rob banks. He wants to make a calculated risk, and grab as much money as possible. But his friends - Hermi…
题意:给出银行的个数和被抓概率上限.在给出每个银行的钱和抢劫这个银行被抓的概率.求不超过被抓概率上线能抢劫到最多的钱. dp题,转移方程 dp[i][j] = min(dp[i-1][j] , dp[i-1][j-v[i]]) ,dp[i][j]表示前 i 个银行抢劫到 j 这么多钱被抓的概率. 初始化时 dp[0][0] = 0 , 因为 dp[0][1~n]是不可能的情况,dp[0][1~n]=-1. #include<stdio.h> #define maxn 110 #define m…
题意:给定一个人抢劫每个银行的被抓的概率和该银行的钱数,问你在他在不被抓的情况下,能抢劫的最多数量. 析:01背包,用钱数作背包容量,dp[j] = max(dp[j], dp[j-a[i] * (1.0 - pp[i])),dp[i] 表示不被抓的最大概率,在能抢劫到 i 个钱. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <stri…
题目链接 题意:Harry Potter要去抢银行(wtf???),有n个银行,对于每个银行,抢的话,能抢到Mi单位的钱,并有pi的概率被抓到.在各个银行被抓到是独立事件.总的被抓到的概率不能超过P. 解题关键:如果考虑各种情况存在某一次被抓住的概率,相当于是取 并集,这个比较麻烦.然而,n个独立事件都不被抓住的概率,相当于是取 交集,直接把要考虑到的事件的不被抓住的概率乘到一起就好了.这样就能把这道题转化为01背包的问题了. 不被抓概率!~物品体积 (不被抓概率不低于某阈值,物品总体积不高于某…
http://lightoj.com/volume_showproblem.php?problem=1079 Just another Robbery As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants everything quick!) so he decided to rob banks. He wants to make a calculated r…
1079 - Just another Robbery   PDF (English) Statistics Forum Time Limit: 4 second(s) Memory Limit: 32 MB As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants everything quick!) so he decided to rob banks. He…
题意:n个银行,每个有价值和被抓概率,要求找被抓概率不超过p的最大价值 题解:dp[i][j]表示前i个取j价值的所需最小概率,01背包处理,转移方程dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+(1-dp[i-1][j-v[i]])*p) #include<bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back #define pi…
KUANGBIN带你飞 全专题整理 https://www.cnblogs.com/slzk/articles/7402292.html 专题一 简单搜索 POJ 1321 棋盘问题    //2019.3.18 POJ 2251 Dungeon Master POJ 3278 Catch That Cow  //4.8 POJ 3279 Fliptile POJ 1426 Find The Multiple  //4.8 POJ 3126 Prime Path POJ 3087 Shuffle…
正推不行就逆推! 经典问题:生日悖论 换成其互斥事件:m个人, 每个人生日都不相同的概率 ≤ 0.5 时最小人数. 这就是邮票收集问题的变形:每个邮票至少出现一次的概率 小于等于 0.5 邮票收集问题资料:https://en.wikipedia.org/wiki/Coupon_collector%27s_problem 我们现在面对的是一个n面的骰子, 骰子的每面都是随机出现的, 求问将所有面都被看完所期望的投掷次数(假设只看最上面那一面) 那么, 问题的解就是: H[n] = (1 + 1/…