Codeforces Round 851 (Div. 2)
B
Sum of Two Numbers
Codeforces
1100
原题
← AC →
翻译中…

The 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$. 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.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10\,000$).

翻译中…

Each test case consists of a single integer $n$ ($1 \leq n \leq 10^9$)

翻译中…

Output

翻译中…

For each test case, print two integers $x$ and $y$.

翻译中…

If there are multiple answers, print any.

翻译中…

Note

翻译中…

In the second test case, the sum of digits of $67$ and the sum of digits of $94$ are both $13$.

翻译中…

In the third test case, the sum of digits of $60$ is $6$, and the sum of digits of $7$ is $7$.

翻译中…

样例

Input #1
5
1
161
67
1206
19
Output #1
1 0
67 94
60 7
1138 68
14 5
InputCopy OutputCopy
题目信息
题号
1788B
时间限制
1 s
内存限制
256 MB
标签
构造
贪心
模拟
数学
概率论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。