0% found this document useful (0 votes)
27 views1 page

Hey, Better Bettor

The document describes a casino offering a deal where a player can gamble as much as they want and receive a refund of x% of any losses. The player is asked to write a program to determine the maximum expected profit for any gambling strategy given the refund percentage x and winning probability p of each bet. The input and output examples show test cases with x and p values, and the corresponding maximum expected profit values calculated to an accuracy of 10-3.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Hey, Better Bettor

The document describes a casino offering a deal where a player can gamble as much as they want and receive a refund of x% of any losses. The player is asked to write a program to determine the maximum expected profit for any gambling strategy given the refund percentage x and winning probability p of each bet. The input and output examples show test cases with x and p values, and the corresponding maximum expected profit values calculated to an accuracy of 10-3.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1573 Hey, Better Bettor

In the casino, the cardinal rule is to keep them playing and to keep them coming back. The
longer they play, the more they lose, and in the end, we get it all.

(from the 1995 film Casino)

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 oer
especially sweet deals. One casino is oering 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 x% 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 oer, but you can redeem it only once.
For simplicity, assume all bets cost 1 dollar and pay out 2 dollars. Now suppose x is 20. If you
make 10 bets in total before quitting and only 3 of them pay out, your total loss is 3.2 dollars. If 6 of
them pay out, you have gained 2 dollars.
Given x and the percentage probability p 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
The input consists of several test cases. A test case consists of the refund percentage x (0 x < 100)
followed by the winning probability percentage p (0 p < 50). Both x and p have at most two digits
after the decimal point.

Output
For each test case, display the maximum expected profit with an absolute error of at most 103 .

Sample Input
0 49.9
50 49.85

Sample Output
0.0
7.10178453

You might also like