#abc242a. A - T-shirt
A - T-shirt
Score : points
问题描述
在某次编程竞赛中,T恤衫将根据以下规则颁发给参赛者。
- 所有排名在 或更高的参赛者都将获得一件 T 恤。
- 另外,从排名第 到第 (包含)之间的参赛者中,随机均匀选出 名参赛者也将获得一件 T 恤。
这次竞赛共有 名参赛者,并且所有人的排名各不相同。
参加了本次比赛的 Iroha-chan 排名在第 位。
请计算她获得 T 恤的概率。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
In a certain programming contest, T-shirts are awarded to participants according to the following rules.
- All participants who ranked -th or higher get a T-shirt.
- Additionally, from the participants who ranked between -th and -th (inclusive), participants chosen uniformly at random get a T-shirt.
There were participants in this contest, and all of them got different ranks.
Iroha-chan, who participated in this contest, ranked -th.
Find the probability that she gets a T-shirt.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer. Your output will be considered correct if the absolute or relative error from the judge's answer is at most .
Sample Input 1
30 500 20 103
Sample Output 1
0.042553191489
Iroha-chan ranked -rd.
She will get a T-shirt if she is among the participants chosen uniformly at random from the participants who ranked between -st and -th, which happens with probability .
Sample Input 2
50 500 100 1
Sample Output 2
1.000000000000
Iroha-chan ranked -st. This time, she is guaranteed to get a T-shirt.
Sample Input 3
1 2 1 1000
Sample Output 3
0.000000000000
Iroha-chan ranked -th. This time, she will never get a T-shirt.
update @ 2024/3/10 10:24:46