POJ2151-----Check the difficulty of problems

本文深入探讨了在编程竞赛中组织者如何通过预赛结果估算参赛团队解决特定问题的概率,进而计算出所有参赛队伍至少解决一题且冠军团队至少解决指定数量题目概率的复杂过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Check the difficulty of problems
Time Limit: 2000MS Memory Limit: 65536K
Total Submissions: 5178 Accepted: 2291

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,鲁小石

首先要计算出每一个人做出一定题目的概率
令dp[i][j][k] 表示 第i个人 在前j题里ACk道题的概率
处理完以后,计算每一个人都至少AC一题的概率
在计算出每一个人做出的题目数都在[1, n] 的概率
两者之差就是答案,  它们差的含义就是 每一个人都至少做出一题,但不是所有人的出题数都在[1, n]

/*************************************************************************
    > File Name: POJ2151.cpp
    > Author: ALex
    > Mail: 405045132@qq.com 
    > Created Time: 2014年12月24日 星期三 16时53分17秒
 ************************************************************************/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

double dp[1010][35][35];
double p[1010][35];

int main()
{
	int m, t, n;
	while (~scanf("%d%d%d", &m, &t, &n))
	{
		if (!m && !t && !n)
		{
			break;
		}
		double x = 1.0, y = 1.0;
		memset (dp, 0, sizeof(dp));
		for (int i = 1; i <= t; ++i)
		{
			for (int j = 1; j <= m; ++j)
			{
				scanf("%lf", &p[i][j]);
			}
		}
		for (int i = 1; i <= t; ++i)
		{
			dp[i][0][0] = 1;
			for (int j = 1; j <= m; ++j)
			{
				double tmp = 1;
				for (int k = 1; k <= j; ++k)
				{
					tmp *= (1 - p[i][k]);
				}
				dp[i][j][0] = tmp;
				for (int k = 1; k <= j; ++k)
				{
					dp[i][j][k] = dp[i][j - 1][k - 1] * p[i][j] + dp[i][j - 1][k] * (1 - p[i][j]);
				}
			}
		}
		for (int i = 1; i <= t; ++i)
		{
			double tmp = 0;
			for (int j = 1; j <= m; ++j)
			{
				tmp += dp[i][m][j];
			}
			x *= tmp;//每一个队伍至少AC一道题的概率
		}
		for (int i = 1; i <= t; ++i)
		{
			double tmp = 0;
			for (int j = 1; j < n; ++j)
			{
				tmp += dp[i][m][j];
			}
			y *= tmp;
		}
		printf("%.3f\n", x - y);
	}
	return 0;
}


一、综合实战—使用极轴追踪方式绘制信号灯 实战目标:利用对象捕捉追踪和极轴追踪功能创建信号灯图形 技术要点:结合两种追踪方式实现精确绘图,适用于工程制图中需要精确定位的场景 1. 切换至AutoCAD 操作步骤: 启动AutoCAD 2016软件 打开随书光盘中的素材文件 确认工作空间为"草图与注释"模式 2. 绘图设置 1)草图设置对话框 打开方式:通过"工具→绘图设置"菜单命令 功能定位:该对话框包含捕捉、追踪等核心绘图辅助功能设置 2)对象捕捉设置 关键配置: 启用对象捕捉(F3快捷键) 启用对象捕捉追踪(F11快捷键) 勾选端点、中心、圆心、象限点等常用捕捉模式 追踪原理:命令执行时悬停光标可显示追踪矢量,再次悬停可停止追踪 3)极轴追踪设置 参数设置: 启用极轴追踪功能 设置角度增量为45度 确认后退出对话框 3. 绘制信号灯 1)绘制圆形 执行命令:"绘图→圆→圆心、半径"命令 绘制过程: 使用对象捕捉追踪定位矩形中心作为圆心 输入半径值30并按Enter确认 通过象限点捕捉确保圆形位置准确 2)绘制直线 操作要点: 选择"绘图→直线"命令 捕捉矩形上边中点作为起点 捕捉圆的上象限点作为终点 按Enter结束当前直线命令 重复技巧: 按Enter可重复最近使用的直线命令 通过圆心捕捉和极轴追踪绘制放射状直线 最终形成完整的信号灯指示图案 3)完成绘制 验证要点: 检查所有直线是否准确连接圆心和象限点 确认极轴追踪的45度增量是否体现 保存绘图文件(快捷键Ctrl+S)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值