POJ2096 Collecting Bugs
Time Limit: 10000MS | Memory Limit: 64000K | |
Total Submissions: 5090 | Accepted: 2529 | |
Case Time Limit: 2000MS | Special Judge |
Description
Two companies, Macrosoft and Microhard are in tight competition. Microhard wants to decrease sales of one Macrosoft program. They hire Ivan to prove that the program in question is disgusting. However, Ivan has a complicated problem. This new program has s subcomponents, and finding bugs of all types in each subcomponent would take too long before the target could be reached. So Ivan and Microhard agreed to use a simpler criteria --- Ivan should find at least one bug in each subsystem and at least one bug of each category.
Macrosoft knows about these plans and it wants to estimate the time that is required for Ivan to call its program disgusting. It's important because the company releases a new version soon, so it can correct its plans and release it quicker. Nobody would be interested in Ivan's opinion about the reliability of the obsolete version.
A bug found in the program can be of any category with equal probability. Similarly, the bug can be found in any given subsystem with equal probability. Any particular bug cannot belong to two different categories or happen simultaneously in two different subsystems. The number of bugs in the program is almost infinite, so the probability of finding a new bug of some category in some subsystem does not reduce after finding any number of bugs of that category in that subsystem.
Find an average time (in days of Ivan's work) required to name the program disgusting.
Input
Output
Sample Input
1 2
Sample Output
3.0000
Source
/*by SilverN*/
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
const int mxn=;
int n,s;
double f[mxn][mxn];
int main(){
cin>>n>>s;
f[n][s]=;
for(int i=n;i>=;i--)
for(int j=s;j>=;j--){
if(i==n && j==s)continue;
f[i][j]=(f[i+][j]*(n-i)*j + f[i][j+]*i*(s-j) +
f[i+][j+]*(n-i)*(s-j)+n*s)/(double)(n*s-i*j);
}
printf("%.5f\n",f[][]);
return ;
}
POJ2096 Collecting Bugs的更多相关文章
- poj2096 Collecting Bugs(概率dp)
Collecting Bugs Time Limit: 10000MS Memory Limit: 64000K Total Submissions: 1792 Accepted: 832 C ...
- poj2096 Collecting Bugs[期望dp]
Collecting Bugs Time Limit: 10000MS Memory Limit: 64000K Total Submissions: 5394 Accepted: 2670 ...
- POJ2096 Collecting Bugs(概率DP,求期望)
Collecting Bugs Ivan is fond of collecting. Unlike other people who collect post stamps, coins or ot ...
- [Poj2096]Collecting Bugs(入门期望dp)
Collecting Bugs Time Limit: 10000MS Memory Limit: 64000K Total Submissions: 6237 Accepted: 3065 ...
- [POJ2096] Collecting Bugs (概率dp)
题目链接:http://poj.org/problem?id=2096 题目大意:有n种bug,有s个子系统.每天能够发现一个bug,属于一个种类并且属于一个子系统.问你每一种bug和每一个子系统都发 ...
- POJ-2096 Collecting Bugs (概率DP求期望)
题目大意:有n种bug,m个程序,小明每天能找到一个bug.每次bug出现的种类和所在程序都是等机会均等的,并且默认为bug的数目无限多.如果要使每种bug都至少找到一个并且每个程序中都至少找到一个b ...
- [poj2096] Collecting Bugs【概率dp 数学期望】
传送门:http://poj.org/problem?id=2096 题面很长,大意就是说,有n种bug,s种系统,每一个bug只能属于n中bug中的一种,也只能属于s种系统中的一种.一天能找一个bu ...
- 【期望DP】[poj2096]Collecting Bugs
偷一波翻译: 工程师可以花费一天去找出一个漏洞——这个漏洞可以是以前出现过的种类,也可能是未曾出现过的种类,同时,这个漏洞出现在每个系统的概率相同.要求得出找到n种漏洞,并且在每个系统中均发现漏洞的期 ...
- 【POJ2096】Collecting Bugs 期望
[POJ2096]Collecting Bugs Description Ivan is fond of collecting. Unlike other people who collect pos ...
随机推荐
- SpringMVC类型转换器、属性编辑器
对于MVC框架,参数绑定一直觉得是很神奇很方便的一个东西,在参数绑定的过程中利用了属性编辑器.类型转换器 参数绑定流程 参数绑定:把请求中的数据,转化成指定类型的对象,交给处理请求的方法 请求进入到D ...
- 获得设备的唯一标识符UDID
在IOS5之后,苹果为避免根据UDID获得用户的信息,而禁止使用uniqueIdentifier获得UDID,但是仍有些应用需要根据UDID区分设备 有一个系统的库IOKit.framework可以获 ...
- Android中使用Notification实现宽视图通知栏(Notification示例二)
Notification是在你的应用常规界面之外展示的消息.当app让系统发送一个消息的时候,消息首先以图表的形式显示在通知栏.要查看消息的详情需要进入通知抽屉(notificationdrawer) ...
- SlidingMenu 侧滑菜单的用法
很多APP都有侧滑菜单的功能,部分APP左右都是侧滑菜单~SlidingMenu 这个开源项目可以很好帮助我们实现侧滑功能,将侧滑菜单引入项目的方式很多中,先通过例子介绍各种引入方式,然后给大家展示个 ...
- 【代码笔记】iOS-正在加载
一,效果图. 二,代码. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the ...
- Entity Framework之IQueryable和list本地集合
我们来说一下Iqueryable集合和List等本地集合的区别,下面我们通过建立一个简单的例子来学习这个知识点,直接进入主题吧 1.首先对比一下两段代码?看一下有什么结果: (1) 第一段代码如图所示 ...
- T-SQL 去除特定字段的前导0
在工作过程中遇到一个需求,要从特定字段中删除前导零,这是一个简单的VARCHAR(10)字段. 例如,如果字段包含"00001A",则SELECT语句需要将数据返回为"1 ...
- Java 数组打印数组的 五种方法
Arrays.toString(arr) for(int n: arr) System.out.println(n+", "); for (int i = 0; i < ar ...
- Mybatis 查不到数据,总是返回Null
mybatis突然查不到数据,查询返回的都是Null,但是 select count(*) from xxx查询数量,返回却是正常的. Preparing: SELECT id,a9004,a9005 ...
- auto_clipboard
黄山松发表于博客园:http://www.cnblogs.com/tomview/p/6137179.html #ifndef __HSS_AUTO_CLIPBOARD_HSS__#define __ ...