#P14611. [NWRRC 2025] Lucky Number Theory
[NWRRC 2025] Lucky Number Theory
题目描述
Lucy is a frequent arcade visitor. All machines at the arcade give out tickets to exchange for prizes! Lucy's favorite machine works as follows.
The machine only has two buttons: "Roll" and "Withdraw". Whenever Lucy presses "Roll", the machine increases the counter on the screen by a randomly generated number between and . At any moment, she can press "Withdraw" to get the number of tickets equal to the counter, which gets reset. In case it's not an integer, the machine generously rounds the counter up before handing out the tickets.
More formally, the machine stores a real number , initially equal to 0. On each "Roll" press, the machine generates --- a random number picked uniformly from the interval . Then, increases by the value of . When the "Withdraw" button is pressed, the machine rounds up, giving the player tickets, and then resets back to zero. Lucy can see the value of on the screen at any moment with as much precision as she wants, and she can use it to decide whether to roll or withdraw.
Lucy has enough arcade tokens to press "Roll" times, and "Withdraw" times. Find a strategy that maximizes the expected number of tickets Lucy can get, and print this maximum expected number.
输入格式
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The only line of each test case contains three integers , , and , denoting the number of rolls, the number of withdrawals, and the upper bound on roll values (; ).
输出格式
For each test case, print the maximum expected number of tickets Lucy can get, as a floating point number. Your answer will be considered correct if its absolute or relative error doesn't exceed .
3
3 2 1
5 5 3
7 1 10
2.6250000000
10.0000000000
35.5000000000
提示
In the first test case, with rolls, withdrawals, and , the optimal strategy is as follows:
Lucy starts with a roll. Depending on the number , there are two possibilities:
- The number is less than . In this case, Lucy should withdraw, then roll two more times, and withdraw at the end. The expected number of tickets in this case is ( ticket for the first withdrawal, and tickets on average after two rolls).
- The number is at least . In this case, it's optimal to roll again, withdraw, then roll for the last time, and withdraw at the end. For the first withdrawal, she will get only one ticket with probability~ (the probability that the sum of the first two rolls is at most 1, given that the first roll was over ), and two tickets with probability . The expected number of tickets is .
Each case happens with probability , so the total expected value for this strategy is .
In the second test case, Lucy can withdraw after every roll, each time getting tickets on average.
In the third test case, Lucy can only withdraw once, and she should do it after all rolls.
京公网安备 11011102002149号