QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 2048 MB Puntuación total: 100

#5646. 均匀化学

Estadísticas

在一个平行宇宙中,存在 $n$ 种化学元素,编号从 $1$ 到 $n$。元素 $n$ 尚未被发现,其发现将是研究的巅峰,并会为发现者带来永恒的声誉以及所谓的 SWERC 奖。

共有 $m$ 名独立的科研人员,编号从 $1$ 到 $m$,他们都在尝试发现该元素。目前,第 $i$ 位科研人员拥有元素 $s_i$ 的样本。每年,每位科研人员都会独立进行一次聚变实验。在聚变实验中,如果科研人员当前拥有元素 $a$ 的样本,他们会产生一种元素 $b$ 的样本,该元素是在 $a+1$ 到 $n$ 之间均匀随机选择的,同时他们会失去元素 $a$ 的样本。不同科研人员或不同年份发现的元素是完全独立的。

第一位发现元素 $n$ 的科研人员将获得 SWERC 奖。如果多名科研人员在同一年发现该元素,他们都将获得该奖项。对于每个 $i = 1, 2, \dots, m$,你需要计算第 $i$ 位科研人员赢得奖项的概率。

输入格式

第一行包含两个整数 $n$ 和 $m$ ($2 \le n \le 100, 1 \le m \le 10$),分别表示元素的数量和科研人员的数量。

第二行包含 $m$ 个整数 $s_1, s_2, \dots, s_m$ ($1 \le s_i < n$),表示科研人员当前拥有的元素。

输出格式

输出 $m$ 个浮点数。第 $i$ 个数应为第 $i$ 位科研人员赢得 SWERC 奖的概率。如果每个数字与正确答案的误差不超过 $10^{-8}$,则你的答案被接受。

样例

样例输入 1

2 3
1 1 1

样例输出 1

1.0 1.0 1.0

说明 1

所有科研人员都会在第一年发现元素 $2$ 并赢得 SWERC 奖。

样例输入 2

3 3
1 1 2

样例输出 2

0.5 0.5 1.0

说明 2

最后一位科研人员肯定会在第一年发现元素 $3$ 并赢得 SWERC 奖。前两位科研人员有 $50\%$ 的概率发现元素 $2$,有 $50\%$ 的概率发现元素 $3$,而只有元素 $3$ 能为他们赢得奖项。

样例输入 3

3 3
1 1 1

样例输出 3

0.625 0.625 0.625

说明 3

每位科研人员在第一年都有 $50\%$ 的独立概率发现元素 $3$,在这种情况下,他们肯定会赢得 SWERC 奖。此外,如果他们都在第一年发现元素 $2$(概率为 $12.5\%$),那么他们将在第二年都发现元素 $3$ 并共同赢得奖项。

样例输入 4

100 7
1 2 4 8 16 32 64

样例输出 4

0.178593469 0.179810455 0.182306771
0.187565366 0.199300430 0.229356322
0.348722518

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.