CF1788B.Sum of Two Numbers
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 a=i=0∑∞ai⋅10i , where 0≤ai≤9 , is defined as i=0∑∞ai .
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≤t≤10000 ).
Each test case consists of a single integer n ( 1≤n≤109 )
输出格式
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 .