QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 256 MB Points totaux : 100

#5635. 这到底是哪种进制?

Statistiques

C++ 和 Java 等编程语言可以使用前缀字符来表示常量整数的进制。例如,十六进制(16 进制)常量以字符串 “0x” 开头。八进制(8 进制)值以字符 “0”(零)开头。十进制(10 进制)值没有前缀。例如,以下所有内容都表示相同的整数常量,尽管进制不同:

0x1234
011064
4660

前缀使编译器能够清楚地知道该值处于什么进制。例如,如果没有 “0x” 前缀,编译器将无法确定 1234 是否为十六进制。它可能是八进制或十进制。

对于本题,你需要编写一个程序,将一串十进制数字分别解释为八进制值、十进制值和十六进制值。

输入格式

输入的第一行包含一个十进制整数 $P$ ($1 \le P \le 10000$),表示随后数据组的数量。每组数据应被独立且相同地处理。

每组数据由单行输入组成。它包含数据组编号 $K$,后跟一个空格,再后跟一个最多包含 7 位十进制数字的字符串。

输出格式

对于每组数据,输出一行。输出行包含数据组编号 $K$,后跟一个空格,以及 3 个由空格分隔的十进制整数,分别表示将输入解释为八进制、十进制和十六进制后的值。如果输入值无法解释为八进制值,则使用值 0。

样例

输入 1

4
1 1234
2 9
3 1777
4 129

输出 1

1 668 1234 4660
2 0 9 9
3 1023 1777 6007
4 0 129 297

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.