QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 1024 MB 總分: 100

#3204. 高风险彩票

统计

Peter 教授决定通过组织一场有着非常独特规则的彩票活动来给他的学生们一个惊喜。

他首先宣布了一个较小的正整数 $M$。之后,每位学生将从集合 $\{1, \dots, M\}$ 中秘密写下一个整数到一张纸条上,然后将纸条折叠起来。在每个人都选好数字后,他们会公布所有的选择,写下最小唯一数字的学生获胜!例如,如果有三名学生,其中两人选择了数字 $2$,另一人选择了数字 $5$,那么选择数字 $5$ 的学生获胜。

这场彩票活动很成功,但 Peter 教授现在想知道他的学生们应该使用什么策略。如果每个人都遵循相同的最优随机策略,那么每个人应该以多大的概率选择每个数字,才能使他们获胜的机会最大化?如果每个人都在遵循该策略,且没有任何个人可以通过选择不同的策略来提高自己的获胜概率,那么该策略就是最优的。你能帮助 Peter 教授吗?

任务

给定班级中的学生人数 $N$ 以及他们可以写下的最大数字 $M$,确定最优随机策略(即所有学生都遵循的策略)。也就是说,确定选择 $1$ 到 $M$ 之间每个数字的概率。

输入格式

输入包含一行,有两个整数:$N$(班级中的学生人数)和 $M$(每位学生可以选择的最大整数)。

数据范围

$3 \le N \le 7$ $1 \le M \le N + 1$

输出格式

输出包含 $M$ 行。第 $k$ 行应包含选择数字 $k$ 的概率。如果结果的绝对误差不超过 $10^{-3}$,则视为正确。

样例

输入格式 1

3 3

输出格式 1

0.46410
0.26795
0.26795

输入格式 2

7 1

输出格式 2

1.00000

输入格式 3

5 6

输出格式 3

0.35785
0.31502
0.19107
0.09512
0.03515
0.00580

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.