QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#14222. 挖矿比赛

Statistics

图 1:Alex 和 Steve 的挖掘路径可能导致碰撞的示例。

Notch 正在为 Steve 和 Alex 举办一场比赛,以看谁是更优秀的矿工。规则很简单:他们每个人都必须向前移动 $n$ 个方块并向下移动 $n$ 个方块。他们可以按自己选择的任何顺序进行——也就是说,他们每个人都要挖掘 $2n$ 次(在他们面前挖掘 $n$ 个方块,在他们下方挖掘 $n$ 个方块),并且可以以任何他们想要的方式对这 $2n$ 个挖掘步骤进行排序。他们绝不会在自己的上方或后方进行挖掘,因为那只会减慢他们的速度。

Steve 和 Alex 不想选择相同的挖掘路径,以避免妨碍彼此或为对手挖掘方块。为了避免这种情况,Alex 决定在比赛开始前,移动到 Steve 后方 $b$ 个方块且下方 $b$ 个方块的位置。然而,当 Steve 和 Alex 开始挖掘时,Notch 意识到他们的方法存在一个问题:在比赛过程中,他们仍然有可能进入彼此的挖掘路径!例如,考虑上图。

Notch 想知道他们的路径是否会相交。假设 Steve 和 Alex 都随机且独立地选择他们的路径(即,每个人都随机选择一个由 $n$ 次向前移动和 $n$ 次向下移动组成的随机排序序列),那么他们的路径在比赛期间发生碰撞的概率是多少?

输入格式

输入仅包含一行,其中有两个整数 $n, b$ ($1 \le b \le n \le 500\,000$)。

输出格式

输出一行,包含 Steve 和 Alex 的挖掘路径相交的概率。如果你的答案的绝对误差或相对误差不超过 $10^{-6}$,则将被视为正确。

样例

输入样例 1

5 3

输出样例 1

0.0318877551

输入样例 2

2 1

输出样例 2

0.4444444444

输入样例 3

3 3

输出样例 3

0.0025000000

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.