QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 27

#14011. Vanishing Numbers

Estadísticas

有一个数池,其中的数是区间 $(0, 1)$ 内的任意小数。在游戏的第一轮中,区间的中间三分之一消失,该区间内的数从数池中被淘汰。在接下来的几轮中,每个剩余区间的中间三分之一都会消失。在第一轮中,区间 $[1/3, 2/3]$ 被淘汰;在第二轮中,两个区间 $[1/9, 2/9]$ 和 $[7/9, 8/9]$ 被淘汰,依此类推。每个被移除区间的端点也会被一并移除。

你的任务是将数池中的数按照它们被淘汰的顺序进行排序。如果某些数永远不会被淘汰,则将它们排在最后。如果出现并列,则将较小的数排在前面。

输入格式

输入的第一行包含测试用例的数量 $T$。接下来是 $T$ 个测试用例。

每个测试用例以包含一个整数 $N$ 的行开始。接下来是 $N$ 个数,每行一个。每个数都以 "0." 开头,后跟一个或多个十进制数字。每个数都大于零,且没有末尾的零。

输出格式

对于每个测试用例,输出一行 "Case #x:",其中 $x$ 是测试用例的编号,从 1 开始。在该行之后,按淘汰顺序每行输出一个数。

数据范围

  • $T \le 100$
  • $N \le 100$

子任务 1(10 分)

  • 每个数在小数点后最多有 5 位数字。

子任务 2(17 分)

  • 每个数在小数点后最多有 11 位数字。

样例

输入样例 1

3
2
0.12
0.5
2
0.9
0.1
3
0.00449602349
0.10613259697
0.3283702389

输出样例 1

Case #1:
0.5
0.12
Case #2:
0.1
0.9
Case #3:
0.00449602349
0.10613259697
0.3283702389

说明

在样例 1 中,0.5 在第一轮被淘汰,因为它落在了区间 $[1/3, 2/3]$ 内。第一轮过后,还剩下两个区间:$(0, 1/3)$ 和 $(2/3, 1)$。数字 0.12 在第二轮被淘汰,因为它落在了区间 $[1/9, 2/9]$ 内。

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.