#abc226h. H - Random Kth Max
H - Random Kth Max
Score : points
问题描述
我们有 个连续随机变量 。其中, 在区间 上服从均匀分布。
令 表示这 个随机变量中第 大值的期望值。按照 Notes 中的规定,输出 的结果。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have continuous random variables . has a continuous uniform distribution over the interval .
Let be the expected value of the -th greatest value among the random variables. Print as specified in Notes.
Notes
In this problem, we can prove that is always a rational number. Additionally, the Constraints of this problem guarantee that, when is represented as an irreducible fraction , is indivisible by .
Here, there uniquely exists an integer between and such that . Print this as the value .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print .
Sample Input 1
1 1
0 2
Sample Output 1
1
The answer is the expected value of the random variable with a continuous uniform distribution over the interval . Thus, we should print .
Sample Input 2
2 2
0 2
1 3
Sample Output 2
707089751
The answer represented as a rational number is . We have , so we should print .
Sample Input 3
10 5
35 48
44 64
47 59
39 97
36 37
4 91
38 82
20 84
38 50
39 69
Sample Output 3
810056397
update @ 2024/3/10 09:56:30