1137 -- Playing games
Time Limit :1000 MS Memory Limit :32768 KB
Accepts : 170 Submits : 355
User Accepts : 140 User Submits : 151
<Submit>   <Statistics>   <Discuss>

Description

Wu Jiaxu (alpc62) likes playing a game named Monsters and Bunnies.
Here are the rules of this game:
Whenever two bunnies meet, nothing happens. Whenever a monster meets a bunny, the monster eats the bunny. Whenever two monsters meet, they start fighting and they both die in the fight.
Whenever you meet a bunny, you can decide whether you kill it or not. A bunny will never kill you. You can not kill a monster. However, if you meet a monster, it will kill you without hesitation.
we have the following assumptions.
    * Meetings will occur at different moments in time.
    * Each time exactly two beings will meet.
    * Those two beings are always chosen uniformly at random from the set of all living beings in town, including you.
You win if at some moment you can not be killed anymore. You are not allowed to leave the town until you either win or get killed.
Write a program that will calculate the expected probability that you will win.
When deciding whether to kill a bunny you just met, your only goal is to maximize your winning probability.
 
Input
 
Multiple test cases. Each test case occupies one line which contains only two integer M, B(0<=M &&<=1000, 0<=B<=1000)
 
Output
 
the expected probability that you will win.
The value should be rounded to six digits after the decimal point.
 
Sample Input
0 0
0 47
1 0
1 47
2 0

Sample Output

1.000000
1.000000
0.000000
0.000000
0.333333

Source

Alpc NUDT campus contest 2008
<Submit>   <Statistics>   <Discuss>
 


Powered by Zhang Zhaoning PDL College of Computer
Since 2006.03.09 | 2007.11.22 | 2010.03.02 Copyright (r) 2006 - 2010 All Rights Reserved