题目描述
Problem Description
Given two integers $ N $ and $ K $.
Consider a machine that selects one integer between $ 1 $ and $ N $ (inclusive) with equal probability.
When this machine is operated three times, find the probability that the median of the three selected numbers is $ K $.
Input Format
The input is given from the standard input in the following format:
$ N $ $ K $
The first line contains two integers $N(1\ ≦\ N\ ≦\ 10^6)$ and $K(1\ ≦\ K\ ≦\ N)$ separated by a space.
Output Format
Output the probability that the median is $ K $. The output should be to the standard output, followed by a newline.
The answer will be considered correct if the absolute or relative error is within $ 10^{-9} $.
Sample Input and Output
Sample Input #1
3 2
Sample Output #1
0.48148148148148148148
Sample Input #2
3 1
Sample Output #2
0.25925925925925925926
Sample Input #3
765 573
Sample Output #3
0.00147697396984624371
Notes/Hints
Sample Explanation 1
The median is $ 2 $ when the outputs (first output, second output, third output) are:
- (1, 2, 3)
- (1, 3, 2)
- (2, 1, 3)
- (2, 3, 1)
- (3, 1, 2)
- (3, 2, 1)
- (1, 2, 2)
- (2, 1, 2)
- (2, 2, 1)
- (3, 2, 2)
- (2, 3, 2)
- (2, 2, 3)
- (2, 2, 2)
The probability of any of these occurring is $13/27\ =\ 0.481481481...$
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分