#P14495. [NCPC 2025] Arithmetic Adaptation

[NCPC 2025] Arithmetic Adaptation

题目背景

:::align{center}

Postcard showing a Norwegian by solving Sample 3. Coloured black and white photo, National Library of Norway. :::

题目描述

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

输入格式

The input consists of:

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

输出格式

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

10
3 7
-1
-2 1
3
1 2
0
-999 999

提示

Explanation of Sample Input 1

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