http://poj.org/problem?id=2151

 
题意 :t个队伍m道题,i队写对j题的概率为pij。冠军是解题数超过n的解题数最多的队伍之一,求满足有冠军且其他队伍解题数都大于等于1的概率。
 
f[i][j][w]表示i队到第j题总共解出w道题的概率.
为了避免重复计数;
pa=所有队伍到最后一道题时的解题数都大于1的概率;
pb=所有队伍到最后一道题时解题数都小于n的概率;
答案为pa-pb.
 
代码如下
 #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
const int maxn=;
const double eps=1e-;
const int modn=;
int m,n,t;
double f[maxn][][]={};
double f1[maxn][]={};
double a[maxn][];
int main(){
while(~scanf("%d%d%d",&m,&t,&n)){
memset(f,,sizeof(f));
if(m==&&n==&&t==)break;
for(int i=;i<=t;i++){
for(int j=;j<=m;j++){
scanf("%lf",&a[i][j]);
}
}
double t1=,t2=,t3,t4;
for(int i=;i<=t;i++){
f[i][][]=;
for(int j=;j<=m;j++){
for(int w=;w<=j;w++){
if(j->=w)f[i][j][w]+=f[i][j-][w]*(1.0-a[i][j]);
f[i][j][w]+=f[i][j-][w-]*a[i][j];
}
}
t3=,t4=;
for(int j=;j<=m;j++){
t3+=f[i][m][j];
if(j<n){
t4+=f[i][m][j];
}
}
t1*=t3;t2*=t4;
}
printf("%.3f\n",t1-t2);
}
return ;
}

POJ2157 Check the difficulty of problems 概率DP的更多相关文章

  1. POJ 2151 Check the difficulty of problems 概率dp+01背包

    题目链接: http://poj.org/problem?id=2151 Check the difficulty of problems Time Limit: 2000MSMemory Limit ...

  2. [ACM] POJ 2151 Check the difficulty of problems (概率+DP)

    Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4748   ...

  3. POJ 2151 Check the difficulty of problems (概率DP)

    题意:ACM比赛中,共M道题,T个队,pij表示第i队解出第j题的概率 ,求每队至少解出一题且冠军队至少解出N道题的概率. 析:概率DP,dp[i][j][k] 表示第 i 个队伍,前 j 个题,解出 ...

  4. [POJ2151]Check the difficulty of problems (概率dp)

    题目链接:http://poj.org/problem?id=2151 题目大意:有M个题目,T支队伍,第i个队伍做出第j个题目的概率为Pij,问每个队伍都至少做出1个题并且至少有一个队伍做出N题的概 ...

  5. [poj2151]Check the difficulty of problems概率dp

    解题关键:主要就是概率的推导以及至少的转化,至少的转化是需要有前提条件的. 转移方程:$dp[i][j][k] = dp[i][j - 1][k - 1]*p + dp[i][j - 1][k]*(1 ...

  6. POJ2151Check the difficulty of problems 概率DP

    概率DP,还是有点恶心的哈,这道题目真是绕,问你T个队伍.m个题目.每一个队伍做出哪道题的概率都给了.冠军队伍至少也解除n道题目,全部队伍都要出题,问你概率为多少? 一開始感觉是个二维的,然后推啊推啊 ...

  7. poj 2151Check the difficulty of problems<概率DP>

    链接:http://poj.org/problem?id=2151 题意:一场比赛有 T 支队伍,共 M 道题, 给出每支队伍能解出各题的概率~  求 :冠军至少做出 N 题且每队至少做出一题的概率~ ...

  8. 【POJ】2151:Check the difficulty of problems【概率DP】

    Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8903   ...

  9. POJ 2151 Check the difficulty of problems (动态规划-可能DP)

    Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4522   ...

随机推荐

  1. 【LibreOJ】#6257. 「CodePlus 2017 12 月赛」可做题2

    [题意]数列满足an=an-1+an-2,n>=3.现在a1=i,a2=[l,r],要求满足ak%p=m的整数a2有多少个.10^18. [算法]数论(扩欧)+矩阵快速幂 [题解]定义fib(i ...

  2. 2017ACM暑期多校联合训练 - Team 6 1008 HDU 6103 Kirinriki (模拟 尺取法)

    题目链接 Problem Description We define the distance of two strings A and B with same length n is disA,B= ...

  3. PHP非常好用的分页类

    分页类: <?php /* * ********************************************* * @类名: page * @参数: $myde_total - 总记 ...

  4. 蓝色简洁的企业cms网站权限后台管理模板——后台

    链接:http://pan.baidu.com/s/1pKUqbBd 密码:nink

  5. WordPress友情链接插件的安装

    插件:link manager 这样就安装成功! 在外观小工具里 把右边即可 这样在前台页面上就可看见添加的友情链接了!!!

  6. 自己看之区间DP

    //菜鸡制作,看的时候可能三目运算符略烦;;; 区间DP入门题:Brackets 地址:http://59.77.139.92/Problem.jsp?pid=1463 分析(对区间DP的代码原理进行 ...

  7. ogg数据初始化历程记录

    之前,源端数据表结构发生改变,不知道前面的同事是怎么搞得(生成的数据定义文件不对,还是没有把进程启动),造成进程停止20天,然后重启复制进程,对比源端和目标端数据有差异(总共差10000多条数据),问 ...

  8. [001] leap_stage

    [Description] There is a number in each stages that indicates the most stages you can leap up. Now, ...

  9. docker简单介绍(资料收集总结)

    [前言] 首先,感谢我的leader总是会问我很多技术的基本资料,让我这个本来对于各种技术只知道操作命令不关注理论知识的人,开始重视理论资料. 关于docker的操作步骤等等,都是之前学习的,现在补上 ...

  10. 在ubuntu上安装Chrome

    1.下载谷歌浏览器源文件.链接有很多,以下是64位版本的下载地址 https://dl.google.com/linux/direct/google-chrome-stable_current_amd ...