#abc266e. E - Throwing the Die
E - Throwing the Die
Score : points
问题陈述
让我们用一个骰子来玩一个游戏。游戏最多包含 轮,每轮的规则如下:
- 投掷一个六面骰子,其上的数字 出现的概率相等,并令 为所显示的数字(每次投掷与其他投掷相互独立)。
- 如果现在是第 轮,你的 得分 为 ,游戏结束。
- 否则,你可以选择继续游戏或结束游戏。
- 如果你选择结束游戏,你的得分即为 ,且不再进行更多轮次。
当你以最大化期望值的方式来玩游戏时,求你的得分的期望值。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Let us play a game using a die. The game consists of at most turns, each of which goes as follows.
- Throw a -sided die that shows with equal probability, and let be the number shown (each throw is independent of the others).
- If it is the -th turn now, your score is , and the game ends.
- Otherwise, choose whether to continue or end the game.
- If you end the game, your score is , and there is no more turn.
Find the expected value of your score when you play the game to maximize this expected value.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Your output is considered correct if its absolute or relative error from the true answer is at most .
Sample Input 1
1
Sample Output 1
3.5000000000
Sample Input 2
2
Sample Output 2
4.2500000000
Sample Input 3
10
Sample Output 3
5.6502176688
update @ 2024/3/10 11:15:06