Logo
(追記) (追記ここまで)

20802번 - Rikka with Subsequence 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB733100.000%

문제

As we all know, Rikka is not good at math. Yuta, her boyfriend, is worried about it. Therefore, he sets an interesting math problem For Rikka to practice.

Given a non-negative integer $x,ドル Rikka is required to find three non-negative integers $a,b,c$ that satisfy the following three conditions:

  1. $a + b = x$;
  2. $\text{str}(c)$ is a subsequence of $\text{str(a)}$;
  3. $\text{str}(c)$ is a subsequence of $\text{str(b)}$.

$\text{str}(d)$ represents the decimal string representation of integer $d$. For example, $\text{str}(0)=$"0ドル$", $\text{str}(103)=$"103ドル$".

String $s=s_1 \dots s_{n}$ is a subsequence of string $t=t_1 \dots t_{m}$ if and only if there exists an index sequence 1ドル \leq i_1 < i_2 < \dots < i_n \leq m$ satisfying $\forall j \in [1,n], s_j = t_{i_j}$.

To avoid the case of no solution, Yuta assumes there is a special choice "$-$" for $c$ where $\text{str}(-)$ is equal to the empty string. Under this assumption, $a=0, b=9, c=-$ becomes a valid solution of $x=9$.

Finding a valid solution is an easy task even for Rikka. Therefore, Rikka wants to increase the difficulty: Rikka wants you to find a valid solution $(a,b,c)$ so that the length of $\text{str}(c)$ is as large as possible.

입력

The first line contains a single integer $T\ (1\leq T\leq 10^4),ドル representing the number of test cases.

For each test case, the first line contains a single integer $x\ (|\text{str}(x)| \leq 5000)$.

The input guarantees that $\sum |\text{str}(x)| \leq 10^5$.

출력

For each test case, output three lines, each with a single integer, representing $a,b,c$ respectively.

If there are multiple optimal solutions, you need only to output any of them.

제한

예제 입력 1

3
2290283839620
1
9999999

예제 출력 1

1145141919810
1145141919810
1145141919810
0
1
-
4545454
5454545
454545

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 7: Grand Prix of Xiaomi E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /