http://acm.hdu.edu.cn/showproblem.php?pid=4815 Description A crowd of little animals is visiting a mysterious laboratory � The Deep Lab of SYSU. “Are you surprised by the STS (speech to speech) technology of Microsoft Research and the cat face recogn…
题目描述 对于n道题目,每道题目有一个分值,答对加分,答错不得分,你要和一个叫深猴的比赛,题目你可以假设成判断题(不是对就是错),深猴对于所有的题目都是随机选择一个答案,而你是有脑子的,求为了不输掉比赛(平局或你获胜)的可能性至少为p时你至少需要得到多少分,有t组数据,每次输入两行,第一行为n,p(有n道题目,n<=40, 不会输的可能性为p,0.0<=p<=1.0),第二行输入n个1~1000的整数,代表这n道题分别答对能获得的分数 样例输入 1 3 0.5 1 2 3 样例输出 3…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4815 简单的DP题. #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <queue> #include <map> #include <set> #include <vector> #i…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4815 [题意] n个题目,每题有各自的分数,A有50%的概率答对一道题目得到相应分数,B想要在至少P的概率上总分不低于A,问B至少要得到多少分. [分析] 最简单粗暴的做法是算出每个可能得到的总分的概率,原问题可以转化成在概率和<=P下A所有可能得到的总分集合中最大分数的最小值为多少,于是答案就是按分数排序后前k项的概率和刚好>=P. 但是计算所有可能的概率的复杂度是O(2n),不能满足我们的需求.细…
概率dp,有点像背包的做法: dp[i][j]代表前i个数组成的j数的概率为多少 #include<cstdio> #include<cstring> #define maxn 40009 using namespace std; ][maxn]; int s; double sco; int main() { int t,n; scanf("%d",&t); while(t--) { memset(dp,,sizeof dp); dp[][]=; sc…
题意:有A,B两个人.n道题目.每题有相应的分数.B答对题目的概率是0.5.求A不输给B的概率不小于P要拿的最低分数 思路:DP,dp[i][j]来表示B答了前i题后分数为j的概率,,然后通过B的概率求A的最低分数 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 40010;…
Buy the souvenirs Time Limit: 10000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description When the winter holiday comes, a lot of people will have a trip. Generally, there are a lot of souvenirs to sell, and sometimes…
点我看题目 题意 : 中文题不详述. 思路 :类似于01背包的DP,就是放与不放的问题,不过这个要求概率,至少得到一份offer的反面就是一份也得不到,所以先求一份也得不到的概率,用1减掉就可以得到所求. //HDU 1203 #include <stdio.h> #include <iostream> using namespace std ; struct node { int a ; double b ; }p[] ; ] ; int main() { int n,m ; w…
http://acm.hdu.edu.cn/showproblem.php?pid=5887 题意: 容量很大的01背包. 思路: 因为这道题目背包容量比较大,所以用dp是行不通的.所以得用搜索来做,但是需要一些剪枝,先按体积排序,优先考虑体积大的物品,这样剪枝会剪得多一些(当然按照性价比排序也是可以的). #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #i…
题目链接:[http://acm.hdu.edu.cn/showproblem.php?pid=3339] In Action Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5951    Accepted Submission(s): 1998 Problem Description Since 1945, when the firs…