题意 : 举办一次比赛不容易,为了不让题目太难,举办方往往希望能够讲出的题目满足两点,1是所有的队伍都至少能够解出一个题目,2是冠军队至少能解出确定数量的题目,最后让你求的是每个队伍至少解出一道题并且冠军队伍解出N道题的概率.

思路 : 我觉得吧,搞ACM不容易,唉,概率这玩意儿,一不小心漏掉一个就完啦。。。。首先呢,概率得好好求,其次呢DP得会一些。。。。

这个题的思路我觉得小优姐的CSDN已经说得很详细了http://blog.csdn.net/lyy289065406/article/details/6648579

样例解释 : 2 2 2

0.9 0.9

1 0.9

第一行M,T,N代表着M道题,T个队伍,希望冠军队做出N道题。接下来是T行M列,表示(i,j)点表示队伍 i 做对 j题的概率是多少。

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
using namespace std ;
const int maxn = ;
const int maxm = ;
double f[maxm][maxn];
double dp[maxm][maxn][maxn];
int main()
{
int M,T,N ;//题目数,队伍数,冠军队做出题目数
while(~scanf("%d %d %d",&M,&T,&N))
{
if(M == &&N == && T == )
break ;
memset(dp,,sizeof(dp));
for(int i = ; i <= T ; i++)
{
for(int j = ; j <= M ; j++)
scanf("%lf",&f[i][j]);
}
for(int i = ; i <= T ; i++)
{
dp[i][][] = 1.0 ;
for(int j = ; j <= M ; j++)
{
dp[i][j][] = dp[i][j-][]*(-f[i][j]);
for(int k = ; k <= j ; k++)
{
dp[i][j][k] = dp[i][j-][k-]*f[i][j]+dp[i][j-][k]*(-f[i][j]);
}
}
}
double p1 = 1.0 ;
for(int i = ; i <= T ; i++)
p1 *= ( - dp[i][M][]) ;
double p2 = 1.0 ;
for(int i = ; i <= T ; i++)
{
double sum = ;
for(int j = ; j < N ; j++)
sum += dp[i][M][j];
p2 *= sum ;
}
printf("%.3f\n",p1-p2); }
return ;
}

POJ2151Check the difficulty of problems的更多相关文章

  1. POJ2151-Check the difficulty of problems(概率DP)

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

  2. poj2151--Check the difficulty of problems(概率dp第四弹,复杂的计算)

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

  3. POJ2151-Check the difficulty of problems

    题目链接:点击打开链接 Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submiss ...

  4. POJ2151Check the difficulty of problems 概率DP

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

  5. POJ 2151 Check the difficulty of problems

    以前做过的题目了....补集+DP        Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K ...

  6. Check the difficulty of problems

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

  7. Check the difficulty of problems(POJ 2151)

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

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

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

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

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

随机推荐

  1. RSS 订阅

    <?xml version="1.0"?><%@ Page Language="C#" AutoEventWireup="true& ...

  2. 2015.1写留言板的时用的 知识点和函数 --->总结

    一:时间函数和uniqid() 1:uniqid():生成唯一的id, 无参数返回的字符串的长度为13,有参数为23 2:时间和时间戳相互转换的php函数 ①:time()  返回当前unix的时间戳 ...

  3. 版权控制之zend guard 6.0使用教程

    zend guard6.0使用教程.doc 一.准备工具 1. ZendGuard-6_0_0 下载地址:http://www.zend.com/en/products/guard/downloads ...

  4. DirectoryEntry配置IIS出现ADSI Error:未知错误(0x80005000)

    目录 问题案例 原因分析 解决问题 总结 问题案例 DirectoryEntry配置IIS,在IIS6.0下运转正常,但IIS7.0下运转会出错: System.DirectoryServices.D ...

  5. iblog语法高亮示例

    -------------------------------------------------------------------------------------- iblog 是一款 Sub ...

  6. Azure Bill

    MSDN的本月订阅的被用完了,所有的付费订阅均变成了不可用的状态. 信用额度为0元,还有2天能恢复 点击上方的MSDN订阅名会进入更加详细的账单,账单以月的形式提供. 邮件中也会通知您到了限定额度所停 ...

  7. Configure Log Shipping

    准备工作 两台装有的Windows Server 2012R2以及SQL Server 2012的服务器 下载评估版 Windows Server 2012 R2 下载 Microsoft SQL S ...

  8. C# 命名参数【转】

    命名参数(Named Arguments)就是说在调用函数时可以通过指定参数名称的方式来调用参数.它最大的好处就是方便调用参数时按调用者的需要来排列顺序,而不必死守函数声明时的顺序(相对于“位置参数” ...

  9. vim中执行shell命令小结

    vim中执行shell命令,有以下几种形式 1):!command 不退出vim,并执行shell命令command,将命令输出显示在vim的命令区域,不会改变当前编辑的文件的内容 例如:!ls -l ...

  10. 一段Android里面打印CallStatck的代码

    public void dumpCallStack() { java.util.Map<Thread, StackTraceElement[]> ts = Thread.getAllSta ...