QOJ.ac

QOJ

時間限制: 6.0 s 記憶體限制: 256 MB 總分: 100

#12916. 街道

统计

你正在玩一种广义的扑克游戏,称为 $(n, k)$-扑克。$(n, k)$-扑克游戏包含 $k$ 轮。在每一轮中,系统会独立且均匀地随机抽取一个 $1$ 到 $n$ 之间的整数。抽取后,你可以选择执行以下两种操作之一:拿走这个数字,或者跳过它,随后本轮结束。

你必须恰好拿走三个数字。如果你拿走的这三个数字在重新排序后能构成一个顺子(即等差数列),你就获胜了。如果你采取最优策略,获胜的概率是多少?

输入格式

输入文件的唯一一行包含两个用空格分隔的整数 $n$ 和 $k$,其中 $1 \le n \le 10000$,$3 \le k \le 10000$。

输出格式

输出一个浮点数,表示在采取最优策略的情况下,在 $(n, k)$-扑克中获胜的概率。如果你的输出与标准答案的误差不超过 $10^{-7}$,则被视为正确。

样例

输入 1

4 3

输出 1

0.25

输入 2

2 5

输出 2

0.6875

说明

三个数字在某种排序下构成等差数列,当且仅当其中一个数字是另外两个数字的平均值。

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.