The number of numbers 0~9 is given. You can arrange these numbers in any order, but you must use them all. The goal is to make the final number as small as possible (note that 0 cannot be the first). For example, given 0 x2s, 1 x1s, 2 x1s, 6 x1s, and 9 x3s, the smallest number you can get is 10026999.
Now given a number, please write a program to output the smallest number that can be formed.
Each test case is given 10 non-negative integers in a row, in order to indicate the number of numbers with numbers 0, numbers 1, ... numbers 9. Integers are separated by a space. The total number of 10 numbers does not exceed 50, and there is at least one non-zero number.
Print the smallest number that can be formed in one line.
2 1 1 0 0 0 1 0 0 3
10026999
2 1 1 0 0 0 1 0 3 0 2 1 1 0 0 0 1 3 0 0
10026888 10026777
M.N.G. = Minimum number of groups
ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |