POJ2151-Check the difficulty of problems
来源:互联网 发布:api函数与c语言 编辑:程序博客网 时间:2024/05/19 02:27
/*首先算出所有队伍至少都有A 1道的概率sum.再算出只A 1~n-1的概率t2答案就是sum-t2咯*/#include<iostream>#include<cstdio>#include<cstring>#define M 31#define T 1001using namespace std;double dp[T][M][M];//dp[i][j][k] 表示第i个队伍前k道题A了j道..double map[M],sum,t2,tt;int m,t,n;int main(){ freopen("test.txt","r",stdin); while(scanf("%d%d%d",&m,&t,&n)&&m!=0&&t!=0&&n!=0) { memset(dp,0,sizeof(dp)); sum=1; t2=1; for(int i=1;i<=t;i++) { dp[i][0][0]=1;//明显前0道题A零道德概率为0 for(int j=1;j<=m;j++) { scanf("%lf",&map[j]); } for(int j=1;j<=m;j++) { for(int k=j;k>=1;k--) { dp[i][k][j]=dp[i][k-1][j-1]*map[j]+dp[i][k][j-1]*(1-map[j]); } dp[i][0][j]=dp[i][0][j-1]*(1-map[j]); } } for(int i=1;i<=t;i++) { sum*=1-dp[i][0][m]; } for(int i=1;i<=t;i++) { tt=0; for(int j=1;j<n;j++) { tt+=dp[i][j][m]; } t2*=tt; } printf("%.3f\n",sum-t2); }}
- POJ2151-Check the difficulty of problems
- Check the difficulty of problems poj2151
- POJ2151--Check the difficulty of problems
- POJ2151-Check the difficulty of problems
- 【POJ2151】【Check the difficulty of problems】
- POJ2151 : Check the difficulty of problems
- poj2151(Check the difficulty of problems) dp
- poj2151 Check the difficulty of problems
- poj2151 Check the difficulty of problems
- 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)
- POJ2151- Check the difficulty of problems(概率DP)
- POJ2151——Check the difficulty of problems
- poj2151 Check the difficulty of problems(概率dp)
- (POJ2151)Check the difficulty of problems <概率DP>
- poj2151 Check the difficulty of problems 概率dp
- Android之ActionBar学习
- 通过结构成员获得结构地址的例子
- 关于投票ip限制的一种手段
- JNI学习笔记(五)——fields和methods
- busybox文件系统的启动顺序
- POJ2151-Check the difficulty of problems
- 佛罗里达更新及搜索引擎的沙盒期效应
- 网站分析基础概念之退出页
- 配置实现快速程序开发
- XNA-3D-绘制立方体
- [易飞]ERP的展BOM程序
- c语言之猜数字游戏
- 社会化媒体上的用户行为分析
- python文件读写