시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB107665263.415%

문제

Practice does make perfect! You have finally achieved proficiency at the task of adding two small nonzero integers $a$ and $b$ to compute their sum $a+b$. Before you move on to studying four-digit numbers, you want to achieve mastery by also understanding the inverse problem: given integer $s$, determine nonzero $a$ and $b$ such that $a+b=s$. None of the numbers may use more than $3$ digits.

입력

The input consists of:

  • One line with an integer $s$ such that $-999\leq s\leq 999$.

출력

Output two integers $a$ (with $-999\leq a\leq 999$ and $a\neq 0$) and $b$ (with $-999\leq b\leq 999$ and $b\neq 0$) such that $a+b=s$. If there is more than one valid solution, you may output any one of them.

예제 입력 1

10

예제 출력 1

3 7

On input "10", the output "3 7" is correct because $3+7=10$. Note that many other outputs would also be correct, such as "2 8", "11 -1", or even "-849 859". On the other hand, the answer "4 7" would be wrong (because $4+7\neq 10$), and so would "10 0" (because both $a$ and $b$ must be nonzero) and "1000 -990" (because both $a$ and $b$ must have at most three digits.)

예제 입력 2

-1

예제 출력 2

-2 1

예제 입력 3

3

예제 출력 3

1 2

예제 입력 4

0

예제 출력 4

-999 999

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2025 A번

  • 문제를 만든 사람: Thore Husfeldt