10035_AFamousGame

2022-5-16 18:16| 发布者: Hocassian| 查看: 76| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504359662900-Problem List-采集的数据-后羿采集器.html

Pro.ID

10035

Title

A Famous Game

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10035

AC

4

Submit

10

Ratio

40.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Mr. B and Mr. M like to play with balls. They have many balls colored in blue and red. Firstly, Mr. B randomly picks up N balls out of them and put them into a bag. Mr. M knows that there are N+1 possible situations in which the number of red balls is ranged from 0 to N, and we assume the possibilities of the N+1 situations are the same. But Mr. M does not know which situation occurs. Secondly, Mr. M picks up P balls out of the bag and examines them. There are Q red balls and P-Q blue balls. The question is: if he picks up one more ball out of the bag, what is the possibility that this ball is red?

    输入

    Each test case contains only one line with three integers N, P and Q (2 ≤ N ≤ 100,000, 0 ≤ PN-1, 0 ≤ QP).

    输出

    Description

    Mr. B and Mr. M like to play with balls. They have many balls colored in blue and red. Firstly, Mr. B randomly picks up N balls out of them and put them into a bag. Mr. M knows that there are N+1 possible situations in which the number of red balls is ranged from 0 to N, and we assume the possibilities of the N+1 situations are the same. But Mr. M does not know which situation occurs. Secondly, Mr. M picks up P balls out of the bag and examines them. There are Q red balls and P-Q blue balls. The question is: if he picks up one more ball out of the bag, what is the possibility that this ball is red?

    Input

    Each test case contains only one line with three integers N, P and Q (2 ≤ N ≤ 100,000, 0 ≤ PN-1, 0 ≤ QP).

    Output

    For each test case, display a single line containing the case number and the possibility of the next ball Mr. M picks out is red. The number should be rounded to four decimal places.

    Sample Input

    3 0 0
    4 2 1

    Sample Output

    Case 1: 0.5000
    Case 2: 0.5000

    Hint

    For example as the sample test one, there are three balls in the bag. The possibilities of the four possible situations are all 0.25. If there are no red balls in the bag, the possibility of the next ball are red is 0. If there is one red ball in the bag, the possibility is 1/3. If there are two red balls, the possibility is 2/3. Finally if all balls are red, the possibility is 1. So the answer is 0*(1/4)+(1/3)*(1/4)+(2/3)*(1/4)+1*(1/4)=0.5.

    Source

    样例输入

    3 0 0
    4 2 1

    样例输出

    Case 1: 0.5000
    Case 2: 0.5000

    提示

    For example as the sample test one, there are three balls in the bag. The possibilities of the four possible situations are all 0.25. If there are no red balls in the bag, the possibility of the next ball are red is 0. If there is one red ball in the bag, the possibility is 1/3. If there are two red balls, the possibility is 2/3. Finally if all balls are red, the possibility is 1. So the answer is 0*(1/4)+(1/3)*(1/4)+(2/3)*(1/4)+1*(1/4)=0.5.


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部