当前位置:网站首页>B1023 group minimum
B1023 group minimum
2022-07-27 05:20:00 【Ye Chen】
1023 Group a minimum number (20 branch )
Given number 0-9 There are several of them . You can arrange these numbers in any order , But all must be used . The goal is to make the final number as small as possible ( Be careful 0 Can't be the first ). for example : Given two 0, Two 1, Three 5, One 8, The smallest number we get is 10015558.
Now give the number , Please write a program to output the smallest number that can be composed .
Input format :
Enter... On one line 10 Nonnegative integers , Order means we have numbers 0、 Numbers 1、…… Numbers 9 The number of . Integers are separated by a space .10 The total number of numbers does not exceed 50, And at least have 1 A non 0 The number of .
Output format :
Output the smallest number that can be composed in one line .
sample input
2 2 0 0 0 3 0 0 1 0
sample output
10015558
Topic analysis :
- Record the number of occurrences
- Note that in addition to 0 Outside the smallest number as the first , And write down the times minus one
The code is as follows :
#include <bits/stdc++.h>
using namespace std;
int main(){
int a[10];
for(int i=0;i<10;i++){
cin>>a[i];
}
for(int i=1;i<10;i++){
if(a[i]!=0){
cout<<i;
a[i]--;
break;
}
}
for(int i=0;i<10;i++){
for(int j=0;j<a[i];j++){
cout<<i;
}
}
return 0;
}
边栏推荐
- Invert a Binary Tree
- 素数筛选(埃氏筛法,区间筛法,欧拉筛法)
- [Niuke discussion area] Chapter 7: building safe and efficient enterprise services
- JVM上篇:内存与垃圾回收篇--运行时数据区四-程序计数器
- Why is count (*) slow
- JVM上篇:内存与垃圾回收篇十四--垃圾回收器
- Complete Binary Tree
- Alphabetic order problem
- Complete Binary Tree
- Raspberry pie output PWM wave to drive the steering gear
猜你喜欢

Derivation and explanation of PBR physical illumination calculation formula

整合SSM
![[optical flow] - data format analysis, flowwarp visualization](/img/7d/2fefc32813ec0c93115e4b290b0944.png)
[optical flow] - data format analysis, flowwarp visualization

Another skill is to earn 30000 yuan a month+

Introduction to MySQL optimization

Standard dialog qmessagebox

JVM上篇:内存与垃圾回收篇五--运行时数据区-虚拟机栈

ERROR! MySQL is not running, but PID file exists

Could not autowire. No beans of ‘userMapper‘ type found.

2021 OWASP top 5: security configuration error
随机推荐
《Robust and Precise Vehicle Localization based on Multi-sensor Fusionin Diverse City Scenes》翻译
Acceptance and neglect of events
Tcp server是如何一个端口处理多个客户端连接的(一对一还是一对多)
JVM上篇:内存与垃圾回收篇五--运行时数据区-虚拟机栈
听过最自律的一句话: 那些我难以言表 不作声响
The provision of operation and maintenance manager is significantly affected, and, for example, it is like an eep command
求组合数(最强优化)
Differences among left join, inner join and right join
辗转相除法
35.滚动 scroll
Introduction to Kali system ARP (network disconnection sniffing password packet capturing)
QT menu bar, toolbar and status bar
JVM Part 1: memory and garbage collection part 11 -- execution engine
DBUtils
JVM上篇:内存与垃圾回收篇十--运行时数据区-直接内存
Standard dialog qmessagebox
弹球小游戏
Another skill is to earn 30000 yuan a month+
Alphabetic order problem
idea远程调试debug