CF1788B.Sum of Two Numbers

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The sum of digits of a non-negative integer aa is the result of summing up its digits together when written in the decimal system. For example, the sum of digits of 123123 is 66 and the sum of digits of 1010 is 11. In a formal way, the sum of digits of a=∑i=0∞ai⋅10i\displaystyle a=\sum_{i=0}^{\infty} a_i \cdot 10^i, where 0≤ai≤90 \leq a_i \leq 9, is defined as ∑i=0∞ai\displaystyle\sum_{i=0}^{\infty}{a_i}.

Given an integer nn, find two non-negative integers xx and yy which satisfy the following conditions.

  • x+y=nx+y=n, and
  • the sum of digits of xx and the sum of digits of yy differ by at most 11.

It can be shown that such xx and yy always exist.

一个非负整数 aa 的各位数字之和,是指其在十进制表示下所有数位上的数字相加所得的结果。例如,123123 的各位数字之和为 66,而 1010 的各位数字之和为 11。形式化地,若 a=∑i=0∞ai⋅10i\displaystyle a=\sum_{i=0}^{\infty} a_i \cdot 10^i(其中 0≤ai≤90 \leq a_i \leq 9),则其各位数字之和定义为 ∑i=0∞ai\displaystyle\sum_{i=0}^{\infty}{a_i}。

给定一个整数 nn,请找出两个非负整数 xx 和 yy,使其满足以下条件:

  • x+y=nx+y=n;
  • xx 的各位数字之和与 yy 的各位数字之和之差的绝对值至多为 11。

可以证明,这样的 xx 和 yy 总是存在的。

输入格式

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

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

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤10 0001 \le t \le 10\,000)。

每个测试用例由一个整数 nn 组成(1≤n≤1091 \leq n \leq 10^9)

输出格式

For each test case, print two integers xx and yy.

If there are multiple answers, print any.

对于每个测试用例,输出两个整数 xx 和 yy。

如果存在多个答案,输出任意一个即可。

输入输出样例

  • 输入#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 6767 and the sum of digits of 9494 are both 1313.

In the third test case, the sum of digits of 6060 is 66, and the sum of digits of 77 is 77.

在第二个测试用例中,6767 的各位数字之和与 9494 的各位数字之和均为 1313。

在第三个测试用例中,6060 的各位数字之和为 66,而 77 的各位数字之和为 77。

输入解题思路,AI测评打分。不知道怎么写?

首页