#P10616. [ICPC 2013 WF] Hey, Better Bettor
[ICPC 2013 WF] Hey, Better Bettor
Description
Recent recessions have not been kind to entertainment venues, including the gambling industry. Competition is fierce among casinos to attract players with lots of money, and some have begun to offer especially sweet deals. One casino is offering the following: you can gamble as much as you want at the casino. After you are finished, if you are down by any amount from when you started, the casino will refund of your losses to you. Obviously, if you are ahead, you can keep all of your winnings. There is no time limit or money limit on this offer, but you can redeem it only once.
For simplicity, assume all bets cost dollar and pay out dollars. Now suppose is . If you make bets in total before quitting and only of them pay out, your total loss is dollars. If of them pay out, you have gained dollars.
Given and the percentage probability of winning any individual bet, write a program to determine the maximum expected profit you can make from betting at this casino, using any gambling strategy.
Input Format
The input consists of a single test case. A test case consists of the refund percentage followed by the winning probability percentage . Both and have at most two digits after the decimal point.
Output Format
Display the maximum expected profit with an absolute error of at most .
0 49.9
0.0
50 49.85
7.10178453
京公网安备 11011102002149号