1788B.md (1433B)
1 Source: https://codeforces.com/problemset/problem/1788/B 2 3 B. Sum of Two Numbers 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 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}$. 22 23 Given an integer $n$, find two non-negative integers $x$ and $y$ which satisfy the following conditions. 24 25 * $x+y=n$, and 26 * the sum of digits of $x$ and the sum of digits of $y$ differ by at most $1$. 27 28 It can be shown that such $x$ and $y$ always exist. 29 30 Input 31 32 Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10\,000$). 33 34 Each test case consists of a single integer $n$ ($1 \leq n \leq 10^9$) 35 36 Output 37 38 For each test case, print two integers $x$ and $y$. 39 40 If there are multiple answers, print any. 41 42 Example 43 44 Input 45 46 ``` 47 5 48 1 49 161 50 67 51 1206 52 19 53 ``` 54 55 Output 56 57 ``` 58 1 0 59 67 94 60 60 7 61 1138 68 62 14 5 63 ``` 64 65 Note 66 67 In the second test case, the sum of digits of $67$ and the sum of digits of $94$ are both $13$. 68 69 In the third test case, the sum of digits of $60$ is $6$, and the sum of digits of $7$ is $7$.