bzoj#P3093. [Fdu校赛2012] A Famous Game

[Fdu校赛2012] A Famous Game

题目描述

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 nn balls out of them and put them into a bag. Mr. M knows that there are n+1n+1 possible situations in which the number of red balls is ranged from 00 to nn, and we assume the possibilities of the n+1n+1 situations are the same. But Mr. M does not know which situation occurs. Secondly, Mr. M picks up pp balls out of the bag and examines them.

There are qq red balls and pqp-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,pn, p and qq.

输出格式

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.

3 0 0
4 2 1
Case 1: 0.5000 
Case 2: 0.5000

数据规模与约定

对于 100%100\% 的数据,2n1052\le n\le 10^50pn10\le p\le n-10qp0\le q\le p

提示

[Explanation]

For example as the sample test one, there are three balls in the bag. The possibilities of the four possible situations are all 0.250.25. If there are no red balls in the bag, the possibility of the next ball are red is 00. If there is one red ball in the bag, the possibility is 13\frac{1}{3}. If there are two red balls, the possibility is 23\frac{2}{3}. Finally if all balls are red, the possibility is 11. So the answer is $0\times(\frac{1}{4})+(\frac{1}{3})\times(\frac{1}{4})+(\frac{2}{3})\times(\frac{1}{4})+1\times(\frac{1}{4})=0.5$.