概率,谁能告诉我这个怎么求概率
Timegoesby.AndattheexactdaysthatBobhascountedoutatprobabilityII,AliceistouchedbyBoban...
Time goes by. And at the exact days that Bob has counted out atprobability II, Alice is touched by Bob and she is willing to be Bob's girlfriend. But before this, Alice decided to test the Bob's ability. Alice also likes probability very much. So she asked Bob a probability question:
There areNballs in a bag. They are in red color or blue. But you don't know the exact the sum of red balls is. So you can assume the sum of the red ballsSr( 0 ≤Sr≤N) probabilitytis equal. You getmballs from the bag, and you find in themballs there areqred balls andm-qblue balls. So what is the expection of probability that if you then (after get out themballs) get another ball in the bag and find the ball is blue?
Bob, as we know, is good at probability. So he solves the problem without thinking even just after the Alice has asked him. Alice believes Bob is a genius. They are together!
What a happy ending!
What importance the math is! Can you solve Alice's problem?
Input
There are several test cases in the input file. Each test case contains only one line with three integersN,mandq( 2 ≤N≤ 10000, 0 ≤m≤N-1, 0 ≤q≤m).
Output
For each test case, output the exception of probability in a single line. The number should be rounded to four decimal places.
Sample Input
3 0 0
Sample output
0.5000 展开
There areNballs in a bag. They are in red color or blue. But you don't know the exact the sum of red balls is. So you can assume the sum of the red ballsSr( 0 ≤Sr≤N) probabilitytis equal. You getmballs from the bag, and you find in themballs there areqred balls andm-qblue balls. So what is the expection of probability that if you then (after get out themballs) get another ball in the bag and find the ball is blue?
Bob, as we know, is good at probability. So he solves the problem without thinking even just after the Alice has asked him. Alice believes Bob is a genius. They are together!
What a happy ending!
What importance the math is! Can you solve Alice's problem?
Input
There are several test cases in the input file. Each test case contains only one line with three integersN,mandq( 2 ≤N≤ 10000, 0 ≤m≤N-1, 0 ≤q≤m).
Output
For each test case, output the exception of probability in a single line. The number should be rounded to four decimal places.
Sample Input
3 0 0
Sample output
0.5000 展开
1个回答
展开全部
时间流逝,某一天,Bob接触到了概率II,Alice被Bob感动了,愿意做他的女朋友,但是首先,她想先考验一下Bob的能力。因为Alice也很喜欢概率,所以她问Bob一个关于概率的问题:
袋子中有N个小球(红色或者蓝色),但是你不知道每种颜色具体的小球个数。所以,你可以假设红色的小球的个数为Sr(0<=Sr<=N)红色或蓝色概率相等。现在,你从袋子中取出m个小球,这m个小球中有q个红色的,剩余m-q个是蓝色的。那么,请问,如果你再从袋子中取出一个小球(已经取出过m了),这个小球是蓝色的概率是多少?
Bob也很擅长概率问题,所以Alice刚问完他就答出来了,Alice相信Bob是天才,他们就在一起了!
多么幸福的结尾!
数学多重要啊!你能解决Alice的问题么?
输入
有若干输入测试情形,每种情形只包含一行、三个整型数N、m和q(2 ≤N≤ 10000, 0 ≤m≤N-1, 0 ≤q≤m)
输出
每种测试情形都要输出单独的一行四位有效数字
例输入
3 0 0
例输出
0.5000
袋子中有N个小球(红色或者蓝色),但是你不知道每种颜色具体的小球个数。所以,你可以假设红色的小球的个数为Sr(0<=Sr<=N)红色或蓝色概率相等。现在,你从袋子中取出m个小球,这m个小球中有q个红色的,剩余m-q个是蓝色的。那么,请问,如果你再从袋子中取出一个小球(已经取出过m了),这个小球是蓝色的概率是多少?
Bob也很擅长概率问题,所以Alice刚问完他就答出来了,Alice相信Bob是天才,他们就在一起了!
多么幸福的结尾!
数学多重要啊!你能解决Alice的问题么?
输入
有若干输入测试情形,每种情形只包含一行、三个整型数N、m和q(2 ≤N≤ 10000, 0 ≤m≤N-1, 0 ≤q≤m)
输出
每种测试情形都要输出单独的一行四位有效数字
例输入
3 0 0
例输出
0.5000
追问
你这个是翻译啊。。。。
追答
哦我以为这么简单,翻一下你就能做出来,看来我高估了你的智商。
图为信息科技(深圳)有限公司
2021-01-25 广告
2021-01-25 广告
边缘计算可以咨询图为信息科技(深圳)有限公司了解一下,图为信息科技(深圳)有限公司(简称:图为信息科技)是基于视觉处理的边缘计算方案解决商。作为一家创新企业,多年来始终专注于人工智能领域的发展,致力于为客户提供满意的解决方案。...
点击进入详情页
本回答由图为信息科技(深圳)有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询