310141: CF1788B. Sum of Two Numbers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Sum of Two Numbers

题意翻译

给定一个 $n$,选取任意满足条件的两个非负整数 $x,y$ ,使得 $x,y$ 满足如下条件: - $x+y=n$ - $x,y$ 的各位数字之和相差不超过 $1$ 多测,共有 $T$ 组数据。

题目描述

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.

输入输出格式

输入格式


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 $ )

输出格式


For each test case, print two integers $ x $ and $ y $ . If there are multiple answers, print any.

输入输出样例

输入样例 #1

5
1
161
67
1206
19

输出样例 #1

1 0
67 94
60 7
1138 68
14 5

说明

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

题意翻译

给定一个 $n$,选取任意满足条件的两个非负整数 $x,y$ ,使得 $x,y$ 满足如下条件: - $x+y=n$ - $x,y$ 的各位数字之和相差不超过 $1$ 多测,共有 $T$ 组数据。

Output

题目大意:
给定一个整数 $n$,找出两个非负整数 $x$ 和 $y$,使得它们的和为 $n$,并且 $x$ 和 $y$ 各位数字之和的差不超过 $1$。题目保证这样的 $x$ 和 $y$ 总是存在。

输入输出数据格式:
- 输入格式:第一行包含一个整数 $t$($1 \le t \le 10,000$),表示测试用例的数量。接下来 $t$ 行,每行包含一个整数 $n$($1 \leq n \leq 10^9$)。
- 输出格式:对于每个测试用例,输出两个整数 $x$ 和 $y$。如果有多个答案,输出其中任意一个。

输入输出样例:
- 输入样例 #1:
```
5
1
161
67
1206
19
```
- 输出样例 #1:
```
1 0
67 94
60 7
1138 68
14 5
```题目大意: 给定一个整数 $n$,找出两个非负整数 $x$ 和 $y$,使得它们的和为 $n$,并且 $x$ 和 $y$ 各位数字之和的差不超过 $1$。题目保证这样的 $x$ 和 $y$ 总是存在。 输入输出数据格式: - 输入格式:第一行包含一个整数 $t$($1 \le t \le 10,000$),表示测试用例的数量。接下来 $t$ 行,每行包含一个整数 $n$($1 \leq n \leq 10^9$)。 - 输出格式:对于每个测试用例,输出两个整数 $x$ 和 $y$。如果有多个答案,输出其中任意一个。 输入输出样例: - 输入样例 #1: ``` 5 1 161 67 1206 19 ``` - 输出样例 #1: ``` 1 0 67 94 60 7 1138 68 14 5 ```

加入题单

算法标签: