538B.md (1182B)
1 Source: https://codeforces.com/problemset/problem/538/B 2 3 B. Quasi Binary 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not. 22 23 You are given a positive integer *n*. Represent it as a sum of minimum number of quasibinary numbers. 24 25 Input 26 27 The first line contains a single integer *n* (1 ≤ *n* ≤ 106). 28 29 Output 30 31 In the first line print a single integer *k* — the minimum number of numbers in the representation of number *n* as a sum of quasibinary numbers. 32 33 In the second line print *k* numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal *n*. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them. 34 35 Examples 36 37 Input 38 39 ``` 40 9 41 ``` 42 43 Output 44 45 ``` 46 9 47 1 1 1 1 1 1 1 1 1 48 ``` 49 50 Input 51 52 ``` 53 32 54 ``` 55 56 Output 57 58 ``` 59 3 60 10 11 11 61 ```