Repdigits
Output: Standard Output (stdout)
Memory limit: 128 megabytes
Time limit: 0.5 seconds
A repdigit is non-negative number composed of the same digit repeated one or more times. For example, the numbers 5, 777, and 99999 are all repdigits.
You will be given a positive integer N. Represent it as a sum of distinct repdigits.
Input
There will be a single line containing the integer N. It is guaranteed that N itself is not a repdigit.
Output
The first line should contain a single integer, K, the number of elements which sum to N in your solution.
The next K lines should each contain a single integer, representing an element of the sum. Each number should be a repdigit, and you should not repeat the same number twice.
You may output the elements in any order, and if there are multiple solutions, you may output any of them. It is guaranteed that a solution always exists.
Subtasks
- Subtask 1 (20%): 1 \le N \le 45
- Subtask 2 (30%): 1 \le N \le 100\,000
- Subtask 3 (30%): 1 \le N \le 1\,000\,000\,000, and it is guaranteed that N can be represented as a sum of exactly 2 distinct repdigits.
- Subtask 4 (20%): 1 \le N \le 1\,000\,000\,000
-
Sample Input 1
42
Sample Output 1
2 9 33
-
Sample Input 2
123
Sample Output 2
3 1 11 111
-
Sample Input 3
10110
Sample Output 3
2 111 9999