poj2151概率dp
来源:互联网 发布:使用vmware安装linux 编辑:程序博客网 时间:2024/05/16 04:36
题目大意:m道题,t个队伍,n个最少题数,给出t*m的概率,表示队伍做出题的概率。求所有队伍都至少出1题,且至少有一个队伍出n道题以上概率。
参考:点击打开链接
代码:
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <fstream>#include <algorithm>#include <cmath>#include <queue>#include <stack>#include <vector>#include <map>#include <set>#include <iomanip>using namespace std;//#pragma comment(linker, "/STACK:102400000,102400000")#define maxn 70#define MOD 1000000007#define mem(a , b) memset(a , b , sizeof(a))#define LL long long#define INF 100000000int m , n , t;double dp[35][35];double sum[3];int main(){ double p; while(scanf("%d %d %d" , &m , &t , &n) != EOF && (m || n || t)) { double ans1 = 1.0 , ans2 = 1.0; for(int i = 0 ; i < t ; i ++) { dp[0][0] = 1; for(int j = 1 ; j <= m ; j ++) { scanf("%lf" , &p); for(int k = 0 ; k <= j && k<= m ; k ++) dp[k][j] = dp[k][j-1]*(1-p) + (k?dp[k-1][j-1]*p:0); } sum[0] = dp[0][m]; sum[1] = 0.0; for(int j = 1 ; j < n ; j ++) sum[1] += dp[j][m]; ans1 *= (1-sum[0]); ans2 *= sum[1]; } printf("%.3lf\n" , ans1 - ans2); } return 0;}
0 0
- poj2151 dp求概率
- poj2151(概率DP)
- poj2151之概率DP
- poj2151 概率dp
- poj2151(概率dp题吧)
- poj2151概率dp
- poj2151(概率dp)
- poj2151 数学+概率dp
- [POJ2151]check the difficulty-概率DP
- POJ2151(DP)
- POJ2151 Check the difficulty of problems 概率+DP
- POJ2151:Check the difficulty of problems(概率DP)
- POJ2151-Check the difficulty of problems(概率DP)
- POJ2151----Check the difficulty of problems(概率dp)
- 概率dp入门[HDU5001][POJ2151][POJ3071][HDU3853][POJ2096]
- POJ2151- Check the difficulty of problems(概率DP)
- poj2151 Check the difficulty of problems(概率dp)
- (POJ2151)Check the difficulty of problems <概率DP>
- HTTP协议
- 8. String to Integer (atoi)
- Powerful Calculator(上海交大上机考试)
- Giraph运行
- HDOJ 1033 Edge
- poj2151概率dp
- 趣味算法-巧填运算符
- Pandas分组统计函数:groupby、pivot_table及crosstab
- 为什么jdk中把String类设计成final?
- UICollectionView 简单实用
- 客户端TIME_WAIT的解决方法与思考
- 个人vimrc配置备份
- 开启CSND技术博客之路
- Oracle db 控制文件笔记