307399: CF1352A. Sum of Round Numbers

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

Description

Sum of Round Numbers

题意翻译

## 题意描述 一个正整数,如果它的形式像 $d0000...00$ 一样,那么就称它为“圆数”,换句话说,“圆数”除了最高位其它的数位都是 $0$ ,特别地,正整数$1\sim9$都是“圆数” 举例来说,$4000,1,9,800,90$都是“圆数”,而$110,707,222,1001$不是“圆数” 给你一个正整数 $n$ , 找出若干个“圆数”,使“圆数”的数量尽可能少,且它们的和等于 $n$。 ## 输入格式 本题有多组数据 第一行一个正整数 $t$,表示数据的组数 接下来的 $t$ 行,每行为一组测试数据,为一个正整数 $n$, ## 输出格式 输出数据 $2t$ 行,对于每组测试数据输出两行 第一行一个正整数 $k$,和是$n$所需要的最少的“圆数”的个数 第二行 $k$ 个“圆数”,且它们的和为 $n$ $k$ 个“圆数”可以按照任何顺序输出,如果有多种答案,输出其中的一种 ## 数据范围与约定 $1 \leq t \leq 10^4$,$1 \leq n \leq 10^4$

题目描述

A positive (strictly greater than zero) integer is called round if it is of the form d00...0. In other words, a positive integer is round if all its digits except the leftmost (most significant) are equal to zero. In particular, all numbers from $ 1 $ to $ 9 $ (inclusive) are round. For example, the following numbers are round: $ 4000 $ , $ 1 $ , $ 9 $ , $ 800 $ , $ 90 $ . The following numbers are not round: $ 110 $ , $ 707 $ , $ 222 $ , $ 1001 $ . You are given a positive integer $ n $ ( $ 1 \le n \le 10^4 $ ). Represent the number $ n $ as a sum of round numbers using the minimum number of summands (addends). In other words, you need to represent the given number $ n $ as a sum of the least number of terms, each of which is a round number.

输入输出格式

输入格式


The first line contains an integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases in the input. Then $ t $ test cases follow. Each test case is a line containing an integer $ n $ ( $ 1 \le n \le 10^4 $ ).

输出格式


Print $ t $ answers to the test cases. Each answer must begin with an integer $ k $ — the minimum number of summands. Next, $ k $ terms must follow, each of which is a round number, and their sum is $ n $ . The terms can be printed in any order. If there are several answers, print any of them.

输入输出样例

输入样例 #1

5
5009
7
9876
10000
10

输出样例 #1

2
5000 9
1
7 
4
800 70 6 9000 
1
10000 
1
10

Input

题意翻译

## 题意描述 一个正整数,如果它的形式像 $d0000...00$ 一样,那么就称它为“圆数”,换句话说,“圆数”除了最高位其它的数位都是 $0$ ,特别地,正整数$1\sim9$都是“圆数” 举例来说,$4000,1,9,800,90$都是“圆数”,而$110,707,222,1001$不是“圆数” 给你一个正整数 $n$ , 找出若干个“圆数”,使“圆数”的数量尽可能少,且它们的和等于 $n$。 ## 输入格式 本题有多组数据 第一行一个正整数 $t$,表示数据的组数 接下来的 $t$ 行,每行为一组测试数据,为一个正整数 $n$, ## 输出格式 输出数据 $2t$ 行,对于每组测试数据输出两行 第一行一个正整数 $k$,和是$n$所需要的最少的“圆数”的个数 第二行 $k$ 个“圆数”,且它们的和为 $n$ $k$ 个“圆数”可以按照任何顺序输出,如果有多种答案,输出其中的一种 ## 数据范围与约定 $1 \leq t \leq 10^4$,$1 \leq n \leq 10^4$

加入题单

算法标签: