b002: [橙]M.N.G.
Tags :
Accepted rate : 18人/20人 ( 90% ) [非即時]
評分方式:
Strictly

最近更新 : 2023-04-01 09:48

Content

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.

Input

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.

Output

Print the smallest number that can be formed in one line.

Sample Input #1
2 1 1 0 0 0 1 0 0 3
Sample Output #1
10026999
Sample Input #2
2 1 1 0 0 0 1 0 3 0
2 1 1 0 0 0 1 3 0 0
Sample Output #2
10026888
10026777
測資資訊:
記憶體限制: 64 MB
不公開 測資點#0 (5%): 0.1s , <1K
不公開 測資點#1 (15%): 0.1s , <1K
不公開 測資點#2 (25%): 0.1s , <1K
不公開 測資點#3 (25%): 0.1s , <1K
不公開 測資點#4 (30%): 0.1s , <1K
Hint :

M.N.G. = Minimum number of groups

Tags:
出處:
[管理者:
admin (Judge)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」