# Minimum number of groups

Source: Internet
Author: User

The number 0-9 is given. You can arrange these numbers in any order, but they must all be used. The goal is to make the final number as small as possible (note that 0 cannot be the first place ). For example, given two 0 s, two 1 s, three 5 S, and one 8 s, the minimum number we get is 10015558.

Given a number, write a program to output the smallest number.

Input Format:

Each input contains one test case. Each test case contains 10 non-negative integers in one row, indicating that we have numbers 0, numbers 1 ,...... The number of digits 9. An integer is separated by a space. The total number of 10 numbers cannot exceed 50, and at least one number is not 0.

Output Format:

Output the smallest number in a row.

Input example:

` 2 2 0 0 0 3 0 1 0 `

Output example:

` 10015558 `

`# Include<Stdio. h>Int main (){Int num [10] = {0}, sum =0;For (Int I =0; I <10; I ++) {scanf ("% D", & Num [I]); sum + = num [I];}For ( Int J =  1; j  10; j ++) { If (Num [J]! =  0) {printf (  " % d  ", j); num [J]-=  1;  Break ;}}  for ( int K =  0; k  10; k ++) { while (Num [k]! =  0) {printf (  " % d  ", k); num [k] --;} printf (  " \ n  ");  return  0 ;}   `

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.