atcoder#ASAPOROE. 迷子の高橋君
迷子の高橋君
Score : points
Problem Statement
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is , and the coordinate of Takahashi is known to be , but his coordinate afterwards cannot be known to Aoki.
Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously:
- Let the current coordinate of Aoki be , then Aoki moves to a coordinate he selects from , and .
- Let the current coordinate of Takahashi be , then Takahashi moves to the coordinate with probability of percent, and moves to the coordinate with probability of percent.
When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi.
Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns.
Constraints
- ≦ ≦
- ≦ ≦
- and are integers.
Partial Scores
- In the test set worth points, .
- In the test set worth points, ≦ .
Input
The input is given from Standard Input in the following format:
Output
Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most .
3
100
2.0000000
Takahashi always moves by . Thus, by moving to the coordinate in the -st turn and staying at that position in the -nd turn, Aoki can find Takahashi in turns.
6
40
7.5000000
101
80
63.7500000