ZOJ Problem Set - 2085
Wishingbone and his brother are both bone-collectors. They love to play a game for exchanging their bones. The rule of this game is simple: His brother knows that Wishingbone is quite smart, so he asks several questions. For each question, if Wishingbone can answer it correctly, he will win a bone, and his brother loses one, otherwise he will give a bone to his brother. Originally, each of them has N bones. The game ends when someone has lost all his bones. Wishingbone wants to know how much is the probability of his final victory. He has calculated the probability of winning one bone by dividing his IQ by the sum of theirs. Since you are also very smart, he left the following calculation to you. You must write a program to help Wishingbone solve this problem.
Author: JIANG, Ming
Source: ZOJ Monthly, February 2004