#P15985. [PA 2026] 骰子 / Kostki
[PA 2026] 骰子 / Kostki
Problem Description
There are players playing a dice game using a fair -sided die (the faces are numbered from to , i.e. each roll results in any value from to with probability ). Initially, every player's score is zero.
In one move, the player with the smallest score rolls the die and adds the result to their score. If at some moment multiple players are tied for the smallest score, then one of them is chosen uniformly at random to take the move.
The game ends when any player's cumulative score reaches or more. Find the expected number of moves.
Input Format
The only line contains three integers , , (), representing the number of players, the number of faces on the die, and the score needed to win.
Output Format
Output one number: the expected number of moves, taken modulo .
It can be proven that the answer can be written as a rational number , where and are integers and . Output the value of . In other words, output the value such that and .
2 4 3
457031255
Hint
Sample Explanation
There are two players, a four-sided die, and the target score is . On the first roll, if the player rolls or , the game ends immediately (with probability ). Otherwise, the second player rolls. Similarly, if they roll or , the game ends (also with probability ). If the game still does not end, then with probability both players have point (case A), with probability one player has point and the other has points (case B), and with probability both players have points (case C).
-
Case A: The first player rolls, and with probability the game ends after the third move. If it does not end, the second player rolls, and with probability the game ends after the fourth move. If it still does not end, then the game must end after the fifth move (the player with points rolls and gains at least more point).
-
Case B: The first player rolls, and with probability the game ends after the third move, and with probability it ends after the fourth move.
-
Case C: The game must end after the third move.
Combining the cases above, the total expectation is:
$$\frac{1}{2} \cdot 1 + \frac{1}{4} \cdot 2 + \frac{1}{4} \cdot \left( \frac{1}{4} \cdot \left( \frac{3}{4} \cdot 3 + \frac{1}{4} \cdot \frac{3}{4} \cdot 4 + \frac{1}{4} \cdot \frac{1}{4} \cdot 5 \right) + \frac{1}{2} \cdot \left( \frac{3}{4} \cdot 3 + \frac{1}{4} \cdot 4 \right) + \frac{1}{4} \cdot 3 \right) = \frac{461}{4^4}$$Since , and , the answer is .
Translated by ChatGPT 5