QOJ.ac

QOJ

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

#14827. Arithmetic Adaptation

Estadísticas

熟能生巧!你终于熟练掌握了将两个非零小整数 $a$ 和 $b$ 相加求和 $a+b$ 的任务。在开始学习四位数之前,你希望通过理解逆问题来达到精通:给定整数 $s$,确定非零整数 $a$ 和 $b$ 使得 $a + b = s$。所有数字的位数都不能超过 3 位。

展示了一名正在解决样例 3 的挪威男孩的明信片。着色黑白照片,挪威国家图书馆。

输入格式

输入包含:

  • 一行,包含一个整数 $s$($-999 \le s \le 999$)。

输出格式

输出两个整数 $a$(满足 $-999 \le a \le 999$ 且 $a \ne 0$)和 $b$(满足 $-999 \le b \le 999$ 且 $b \ne 0$),使得 $a + b = s$。如果存在多个可行解,你可以输出其中任意一个。

样例

输入格式 1

10

输出格式 1

3 7

说明

对于输入 10,输出 3 7 是正确的,因为 $3 + 7 = 10$。请注意,许多其他输出也是正确的,例如 2 811 -1 甚至 -849 859。另一方面,答案 4 7 是错误的(因为 $4 + 7 \ne 10$),10 0 也是错误的(因为 $a$ 和 $b$ 都必须是非零的),1000 -990 也是错误的(因为 $a$ 和 $b$ 的位数都不能超过三位)。

输入格式 2

-1

输出格式 2

-2 1

输入格式 3

3

输出格式 3

1 2

输入格式 4

0

输出格式 4

-999 999

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.