{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cblockquote class\u003d\"quote\"\u003e\n ā\u003cem\u003eIn the casino, the cardinal rule is to keep them playing\n and to keep them coming back. The longer they play, the more\n they lose, and in the end, we get it all.\u003c/em\u003eā\n\n \u003cdiv style\u003d\"text-align:right\"\u003e\n (from the 1995 film \u003cem\u003eCasino\u003c/em\u003e)\n \u003c/div\u003e\n \u003c/blockquote\u003e\n\n \u003cp\u003eRecent recessions have not been kind to entertainment\n venues, including the gambling industry. Competition is fierce\n among casinos to attract players with lots of money, and some\n have begun to offer especially sweet deals. One casino is\n offering the following: you can gamble as much as you want at\n the casino. After you are finished, if you are down by any\n amount from when you started, the casino will refund\n \u003cspan class\u003d\"tex2jax_process\"\u003e$x\\% $\u003c/span\u003e of your losses to\n you. Obviously, if you are ahead, you can keep all of your\n winnings. There is no time limit or money limit on this offer,\n but you can redeem it only once.\u003c/p\u003e\n\n \u003cp\u003eFor simplicity, assume all bets cost 1 dollar and pay out 2\n dollars. Now suppose \u003cspan class\u003d\"tex2jax_process\"\u003e$x$\u003c/span\u003e\n is 20. If you make 10 bets in total before quitting and only 3\n of them pay out, your total loss is 3.2 dollars. If 6 of them\n pay out, you have gained 2 dollars.\u003c/p\u003e\n\n \u003cp\u003eGiven \u003cspan class\u003d\"tex2jax_process\"\u003e$x$\u003c/span\u003e and the\n percentage probability \u003cspan class\u003d\"tex2jax_process\"\u003e$p$\u003c/span\u003e\n of winning any individual bet, write a program to determine the\n maximum expected profit you can make from betting at this\n casino, using any gambling strategy.\u003c/p\u003e\n\n \u003ch2\u003eInput\u003c/h2\u003e\n\n \u003cp\u003eThe input consists of a single test case. A test case\n consists of the refund percentage \u003cspan class\u003d\"tex2jax_process\"\u003e$x$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$0\n \\le x \u0026lt; 100$\u003c/span\u003e) followed by the winning probability\n percentage \u003cspan class\u003d\"tex2jax_process\"\u003e$p$\u003c/span\u003e\n (\u003cspan class\u003d\"tex2jax_process\"\u003e$0 \\le p \u0026lt; 50$\u003c/span\u003e). Both\n \u003cspan class\u003d\"tex2jax_process\"\u003e$x$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$p$\u003c/span\u003e have at most two digits after the\n decimal point.\u003c/p\u003e\n\n \u003ch2\u003eOutput\u003c/h2\u003e\n\n \u003cp\u003eDisplay the maximum expected profit with an absolute error\n of at most \u003cspan class\u003d\"tex2jax_process\"\u003e$10^{-3}$\u003c/span\u003e.\u003c/p\u003e\n\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e0 49.9\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0.0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e50 49.85\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e7.10178453\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}