QOJ.ac

QOJ

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

#4664. 断开的连接

Estadísticas

这是一个双重运行的问题。

Alice 需要告诉 Bob 一个严格小于 $10^{10}$ 的非负整数 $X$。但是他们之间的互联网通道损坏了,因此 Alice 发送的数字中的各位数字被随机打乱了。

Alice 可以发送任意由不超过 50 位数字组成的非负整数(允许前导零)。

Bob 在收到 Alice 发送的整数后,该整数的字符串表示已被打乱。他的任务是利用这些信息确定 $X$。

输入格式

输入的第一行包含一个字符串——如果是 Alice 的数据,则为 “Alice”;如果是 Bob 的数据,则为 “Bob”。

如果输入是 Alice 的数据,第二行包含秘密整数 $X$ ($0 \le X < 10^{10}$),且不包含多余的前导零。

如果输入是 Bob 的数据,第二行包含一个由数字组成的字符串 $s$——即 Alice 发送的数字被打乱后的结果。字符串 $s$ 不为空,且长度不超过 50 位。

输出格式

当处理 Alice 的输入时,输出一个非空的数字字符串,长度不超过 50 位。

当处理 Bob 的输入时,输出一个整数——即秘密整数 $X$ 的值。

样例

输入格式 1

Alice
2022

输出格式 1

01102022

输入格式 2

Bob
20221010

输出格式 2

2022

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.