POJ 2151 Check the difficulty of problems(概率dp)

02 - GRACE数据处理步骤简叙 本篇对GRACE数据处理的过程进行了介绍,简单叙述了进行数据各种改正的原因,可以帮助理解GRACE数据处理理论,本文借鉴了多篇优秀博士论文。希望可以对👪有所帮助。 阅读详情

Language:
Check the difficulty of problems
Time Limit: 2000MS Memory Limit: 65536K
Total Submissions: 5419 Accepted: 2384

Description

Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms: 
1. All of the teams solve at least one problem. 
2. The champion (One of those teams that solve the most problems) solves at least a certain number of problems. 

Now the organizer has studied out the contest problems, and through the result of preliminary contest, the organizer can estimate the probability that a certain team can successfully solve a certain problem. 

Given the number of contest problems M, the number of teams T, and the number of problems N that the organizer expect the champion solve at least. We also assume that team i solves problem j with the probability Pij (1 <= i <= T, 1<= j <= M). Well, can you calculate the probability that all of the teams solve at least one problem, and at the same time the champion team solves at least N problems? 

Input

The input consists of several test cases. The first line of each test case contains three integers M (0 < M <= 30), T (1 < T <= 1000) and N (0 < N <= M). Each of the following T lines contains M floating-point numbers in the range of [0,1]. In these T lines, the j-th number in the i-th line is just Pij. A test case of M = T = N = 0 indicates the end of input, and should not be processed.

Output

For each test case, please output the answer in a separate line. The result should be rounded to three digits after the decimal point.

Sample Input

2 2 2
0.9 0.9
1 0.9
0 0 0

Sample Output

0.972

Source

POJ Monthly,鲁小石


题意: n个人,m道题,求每个人做出题,并且至少一个做出k道题的概率

思路:等于每个人做出题的概率--每个人做出题并且没有一个人做出k到题的概率


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>


#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define MID(x,y) ((x+y)>>1)

#define eps 1e-8
typedef __int64 ll;

#define fre(i,a,b)  for(i = a; i < b; i++)
#define free(i,b,a) for(i = b; i >= a;i--)
#define mem(t, v)   memset ((t) , v, sizeof(t))
#define ssf(n)      scanf("%s", n)
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pf          printf
#define bug         pf("Hi\n")

using namespace std;

#define INF 0x3f3f3f3f
#define N 1005

double dp[N][35][35];  // dp[i][j][k]  第 i 个人 前 j 道题 做 k 道概率
double p[N][35];
int n,m,k;

void solve()
{
	int i,j,t;
	mem(dp,0);

    fre(i,1,n+1)         //初始每一个人第一道题 对 与不对
      {
      	dp[i][1][0]=1-p[i][1];
		dp[i][1][1]=p[i][1];
      }

	fre(i,1,n+1)         //每一个人m到题都没有作对
	 {
	 	fre(j,2,m+1)
		  dp[i][j][0]=dp[i][j-1][0]*(1-p[i][j]);
	 }

	fre(i,1,n+1)        //每一个人j道题 做t道概率
	 fre(j,2,m+1)
	  fre(t,1,j+1)
	 {
       if(t<j)
		 dp[i][j][t]=dp[i][j-1][t]*(1-p[i][j])+dp[i][j-1][t-1]*p[i][j];
	   else
	     dp[i][j][t]=dp[i][j-1][t-1]*p[i][j];
	 }

	 double p1=1,p2;

	 fre(i,1,n+1)
	    p1*=(1-dp[i][m][0]);    //每个人都做出提的概率

	 p2=1;

	 fre(i,1,n+1)
	  {
	  	 double te=0;
	  	 fre(j,1,k)
	  	   te+=dp[i][m][j];
		 p2*=te;            //每个人做出题但是没有一个做了k道题的概率
	  }

	pf("%.3lf\n",p1-p2);
}

int main()
{
	int i,j;
	while(~sfff(m,n,k),n+m+k)
	{
		fre(i,1,n+1)
		   fre(j,1,m+1)
		     scanf("%lf",&p[i][j]);
	   solve();
	}
    return 0;
}


面经-2023-哲库Zeku-数字芯片设计 阅读详情

相关推荐

如何用Deep OC-SORT提升多目标跟踪精度?实战配置与性能优化指南

本文是一份针对开发者的Deep OC-SORT多目标跟踪实战指南。详细解析了如何通过部署其核心的“动态外观记忆”与“相机防抖”模块来有效应对遮挡与抖动,从而显著提升跟踪精度与连续性。内容涵盖从环境搭建、参数调优到性能压榨的全流程,并提供针对不同场景的配置建议与工程落地技巧。

f9g0h的博客 670

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

题目链接: http://poj.org/problem?id=2151 题意: 题目中有TTT个人,MMM道题,做出最多题数要大于等于NNN,给你一个ppp矩阵,p[i][j]p[i][j]p[i][j]表示第iii个人写出第jjj题的概率。 现求满足每个人写题数量都至少大于等于1并且做题数量最多的人写题数量大于N的概率。 题解: 设TTT为全部人的一个集合,f(t)f(t)f(t) 为 ttt...

流水 207

SAP SD模块进阶:VA31和VA01底层竟是同一个BAPI?揭秘销售单据创建的统一逻辑

本文深入解析SAP SD模块中VA31和VA01的底层统一架构设计,揭示两者如何通过同一个BAPI `SD_SALESDOCUMENT_CREATE`实现销售单据创建。通过ABAP调试和参数化设计分析,展示了SAP如何利用单据类型(doc_type)等关键字段实现业务逻辑复用,为开发者提供配置化设计的重要启示。

weixin_30561177的博客 243

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

题目地址:POJ 2151 dp[i][j][k]表示第i个人前j个题做对了k道题的概率。然后把dp数组求出来之后,再利用容斥原理求出最终概率。 代码如下; #include #include #include #include #include #include #include #include #include using namespace std; #define

scf0920 841

零倾覆力矩点(ZMP)

从形式上讲,ZMP 指的是空间中相对于一个平面(通常是地平面)抵消接触力矩的点的集合。这个集合实际上是一个轴,而不是一个点,但为了方便起见,让我们按照传统的推导方法来计算地面平面上的 ZMP。这一推导从任何多刚体系统的牛顿-欧拉运动方程开始:其中,为机器人的总质量,为重力矢量,为系统的重心,为加速度,为固定点的角动量变化率。在右侧,表示净接触扭矩,即施加到机器人上的所有接触扭矩之和,坐标取自质心 (COM)。

机器人控制与仿真应用 2371

散户渡劫指南:从炼气期到化神期的量化之路

经常有人问我普通人怎么学习量化交易,我就在想怎么学了量化就不是普通人了吗,可能他的意思是类比修仙,量化素人如何修炼进阶,今天就将量化学习每个阶段均对标修仙境界的核心能力与心法要诀一一介绍,助你从“交易凡人”蜕变为“量化金仙”。

木头大左的博客 1338

poj 2151 Check the difficulty of problems 概率dp

题意:在acm比赛中,n题,t队。给出每个队做对每题的概率,问每队至少对一题,至少有一队做对至少m题的概率 分析:dp,f[i][j]表示第i个队伍做对第j题的概率。g[i][j][k]表示第i个队伍对于前j题而言做对k道的概率。 g[i][j][k] = g[i][j - 1][k - 1] * (f[i][j]) + g[i][j - 1][k] * (1 - f[i][j]);

u013087645的专栏 1106

国家自然基金研究方向选定后,关键词只能下拉吗?——不是的,国家自然科学基金(NSFC)的关键词并不是只能下拉选择,而是:[特殊字符] “可选 + 可填”的混合模式(但以规范词为主)

你可以手动输入关键词用于表达新兴方向或细分领域✔ 适用情况:新概念(如“电场调控纳米流体”)交叉领域(如“电流体力学传热耦合”)电场调控电流体力学可以自己填,但必须以系统标准关键词为主,自定义为辅如果你愿意,我可以帮你做一件更关键的事:👉根据你题目,反向设计“最容易中标”的关键词组合 + 学科代码搭配这个比写内容本身还更影响送审质量。你可以手动输入关键词用于表达新兴方向或细分领域✔ 适用情况:新概念(如“电场调控纳米流体”)交叉领域(如“电流体力学传热耦合”)电场调控电流体力学。

qq_15963745的博客 81

POJ2151:Check the difficulty of problems(概率DP)

Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms: 1. All

ACM!荣耀之路! 2609

华为OD机试 - 项目规划 - 深度优先搜索dfs(Java 2024 C卷 100分)

每一题都有详细的答题思路、详细的代码注释、样例测试,发现新题目,随时更新,全天优快云在线答疑。

学Java,找哪吒 1153

AUTOSAR从入门到精通-【自动驾驶】特斯拉全自动驾驶(FSD)

特斯拉全自动驾驶系统(Full-Self Driving,简称FSD)是特斯拉公司开发的高级驾驶辅助系统,旨在通过神经网络技术实现环境感知与车辆控制,在驾驶员监督下完成导航、转向、变道、泊车等操作。‌ 该系统自2021年发布Beta测试版以来持续迭代,最新版本为2025年10月推出的v14版本。‌FSD v14版本基于端到端神经网络架构,取代了传统代码逻辑,通过数百万视频片段训练模型,以模仿人类驾驶决策。‌ 其功能覆盖住宅区街道、城市道路及高速公路,支持交通信号识别、自动变道和环岛通行等场景。

getusushu的博客 570

POJ 2151 Check the difficulty of problems(dp,求概率)

题目大意: 求每个队伍都至少做出一题,并且有人做题数大于等于N的概率。 解题思路: dp[i][j][k]表示第i支队伍在前j道题中做出k道的概率。 转移方程为: dp[i][j][k] = dp[i][j-1][k] * (1 - p[i][j]) + dp[i][j-1][k-1] * p[i][j]; 用s[i][j]表示第i支队伍作出的题目小于等于j的概率。 则s[i][j]

蘑菇--走在通往梦想的道路上。 733

OpenClaw 2026.3.13 踩坑实录:飞书HTTP协议降级Bug与多版本回归问题汇总

摘要:OpenClaw v2026.3.13存在多个严重回归问题,包括飞书API调用协议意外降级为HTTP导致连接失败(#46100)、本地Gateway诊断矛盾(#45504)及设备配对CLI命令失效等。该版本发布流程本身也存在异常,被迫以v2026.3.13-1标签重新发布。建议飞书用户回退至v2026.3.8稳定版,其他用户谨慎升级。本文详细记录了各Bug现象、影响范围及临时解决方案,并梳理了飞书通道的"多版本回归史",指出其根源在于架构变迁和测试覆盖不足。最后提供了包含配置备份、

Maynor的博客 868

POJ 2151 Check the difficulty of problems [概率DP]

一场ACM比赛中,有M道题,T只队伍,现在知道每只队伍对于每一题的AC概率,问全场每个队伍都A出至少一题且至少有一只队伍A了N道题的概率。

Asuna_acmer 599

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

POJ 2151 Check the difficulty of problems 概率DP

题目大意: 就是现在有一场比赛有M道题( 大致思路: 就是一个典型的dp吧 ( ﹁ ﹁ ), 过程见代码注释 Result  :  Accepted     Memory  :  15996 KB     Time  :  125 ms /* * Author: Gatevin * Created Time: 2014/12/3 14:44:18 * File Name:

Gatevin的专栏 690

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

POJ 2151 Check the difficulty of problems(概率dp)

POJ 2151 Check the difficulty of problems(概率dp啊)

1215

poj 2151 Check the difficulty of problems 概率dp

Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5636   Accepted: 2474 Description Organizing a programming contest is not an

kimnoic的专栏 328

Check the difficulty of problems (概率DP)poj2151

Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7104   Accepted: 3078 Description Organizing a programming contest is not an

Welcome ! This is Guanpx's blog. 630

POJ - 2151-Check the difficulty of problems-概率dp

题意:有t支队伍,m道题,冠军最少做n道题,问保证每队最少做一题,冠军最少做n题的概率思路:高中知识还真是没剩下多少了,下面转载别人博客中的解释,很详细,基本上看着这个思路,将之代码化就能过,注意精度。 #include #include #include double dp[1005][35][35],p[1005][35],s[1005][35]; int main() {

命运在指间 590

POJ2151Check the difficulty of problems【概率dp求概率】

Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5863   Accepted: 2556 Description Organizing a program

走一步再走一步 603

【POJ - 2151】Check the difficulty of problems(概率dp)

​​​​题干: Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms: 1. All of th...

xuanweiace的博客 575

POJ 2151 Check the difficulty of problems 概率DP入门

Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8024   Accepted: 3422 Description Organizing a programming contest is not

J. Cole 281

poj_2151 Check the difficulty of problems(概率dp)

Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7053   Accepted: 3051 Description Organizing a programming contest is not an

凳子 402

Poj 2151 Check the difficulty of problems (概率DP)

Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5779   Accepted: 2518 Description Organizing a programming contest is not an e

Grit_ICPC的博客 635

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

Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms: 1. All of the teams so...

菜鸡的博客 301

POJ 2151 Check the difficulty of problems:概率dp【至少】

题目链接:http://poj.org/problem?id=2151 题意:   一次ACM比赛,有t支队伍,比赛共m道题。   第i支队伍做出第j道题的概率为p[i][j].   问你所有队伍都至少做出一道,并且有队伍做出至少n道的概率。 题解:   关于【至少】问题的表示。      对于每一支队伍:     mst[i][j] = P(第i支队伍做出至多j...

a1392136的博客 140

POJ 2151 Check the difficulty of problems 详细题解 (概率DP)

Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7351   Accepted: 3174 Description Organizing a programming contest is not

K键盘里的青春K 1015
上一篇: HDU 5188 zhx and contest(带限制条件的 01背包)
下一篇: POJ 2096 Collecting Bugs(概率dp)
左眼皮跳跳~
博客等级 码龄13年 17粉丝 400原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值