|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|5 초||512 MB||9||3||3||33.333%|
You have been invited to the popular TV show "Would you like to be a millionaire?". Of course you would!
The rules of the show are simple:
If you win the bet, your total amount of money increases by the amount you bet. Otherwise, your amount of money decreases by the amount you bet.
Given M, P and X, determine your probability of winning at least \$1000000 if you play optimally (i.e. you play so that you maximize your chances of becoming a millionaire).
The first line of input gives the number of cases, N.
Each of the following N lines has the format "M P X", where:
For each test case, output one line containing "Case #X: Y", where:
Answers with a relative or absolute error of at most 10-6 will be considered correct.
2 1 0.5 500000 3 0.75 600000
Case #1: 0.500000 Case #2: 0.843750
In the first case, the only way to reach \$1000000 is to bet everything in the single round.
In the second case, you can play so that you can still reach \$1000000 even if you lose a bet. Here's one way to do it: