atcoder#ABC266E. [ABC266E] Throwing the Die
[ABC266E] Throwing the Die
Score : points
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.
- 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 .
1
3.5000000000
2
4.2500000000
10
5.6502176688