QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 64 MB Puntuación total: 50

#13774. ZAMKA

Estadísticas

不可能发生的事情发生了。熊 G. 掉进了他自己设下的陷阱里。在美味的 Domaćica 饼干盒的诱惑下,他想都没想就冲了过去,结果掉进了陷阱。为了脱离陷阱,他必须在你的帮助下解决以下任务。给你三个整数 $L$、$D$ 和 $X$。

  • 确定最小的整数 $N$,使得 $L \le N \le D$ 且其各位数字之和为 $X$。
  • 确定最大的整数 $M$,使得 $L \le M \le D$ 且其各位数字之和为 $X$。

如果熊能正确确定数字 $N$ 和 $M$,他就能从陷阱中逃脱。数字 $N$ 和 $M$ 保证总是存在。

输入格式

输入的第一行包含整数 $L$($1 \le L \le 10\,000$),即任务中的数字。

输入的第二行包含整数 $D$($1 \le D \le 10\,000$,$L \le D$),即任务中的数字。

输入的第三行包含整数 $X$($1 \le X \le 36$),即任务中的数字。

输出格式

输出的第一行必须包含任务中的整数 $N$。

输出的第二行必须包含任务中的整数 $M$。

样例

输入 1

1
100
4

输出 1

4
40

输入 2

100
500
12

输出 2

129
480

输入 3

1
10000
1

输出 3

1
10000

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.