QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 128 MB 總分: 100

#3115. 另一个彩票

统计

即使在经济危机时期,Byteland 的人们仍然热衷于参与彩票抽奖。只要运气足够好,他们就有可能摆脱所有烦恼,一夜暴富。

Byteland 最受欢迎的彩票由 $m$ 轮组成。在每一轮中,每个人都可以购买任意数量的彩票。在这一轮售出的所有彩票中,会随机抽取一张中奖,每张彩票中奖的概率相同。该彩票的持有者将获得本轮的奖金。由于 Byteland 的人们喜欢 $2$ 的幂,第 $i$ 轮获胜者的奖金为 $2^i$ Byteland 元。

你能否为彩票中的每位参与者计算出他赢得的奖金严格多于其他任何人的概率?

输入格式

输入包含多组测试数据。每组测试数据的第一行包含两个整数 $n$ 和 $m$,分别表示彩票参与者的人数和彩票的轮数。你可以假设 $1 \le n \le 10000$ 且 $1 \le m \le 30$。

接下来的 $n$ 行描述了每位参与者购买的彩票情况。第 $i$ 行包含 $m$ 个非负整数 $c_1, \dots, c_m$,其中 $c_j$ ($1 \le j \le m$) 表示第 $i$ 位参与者在第 $j$ 轮购买的彩票数量。每一轮售出的彩票总数在 $1$ 到 $10^9$ 之间。

输入以一行包含两个 $0$ 的数据结束。

输出格式

对于每组测试数据,输出 $n$ 行,第 $i$ 行包含第 $i$ 位参与者赢得最多奖金的概率,以最简分数形式表示。详情请参考样例输出。

样例

样例输入 1

5 4
3 1 2 3
3 1 2 4
3 1 3 5
4 4 4 0
5 5 0 0
1 1
1
0 0

样例输出 1

1 / 4
1 / 3
5 / 12
0 / 1
0 / 1
1 / 1

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.