[BOJ 27488] Sum of Two Numbers
View as PDFThe sum of digits of a non-negative integer $a$ is the result of summing up its digits together when written in the decimal system. For example, the sum of digits of $123$ is $6$ and the sum of digits of $10$ is $1$.</p>
In a formal way, the sum of digits of $\displaystyle a=\sum_{i=0}^{\infty} a_i \cdot 10^i$, where $0 \leq a_i \leq 9$, is defined as $\displaystyle\sum_{i=0}^{\infty}{a_i}$.
Given an integer $n$, find two non-negative integers $x$ and $y$ which satisfy the following conditions.
- $x+y=n$, and
- The sum of digits of $x$ and the sum of digits of $y$ differ by at most $1$.
It can be shown that such $x$ and $y$ always exist.
입력 형식
Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10\,000$). </p>
Each test case consists of a single integer $n$ ($1 \leq n \leq 10^9$)
출력 형식
For each test case, print two integers $x$ and $y$.</p>
If there are multiple answers, print any.
예제 입력
5
1
161
67
1206
19
예제 출력
1 0
67 94
60 7
1138 68
14 5
Comments