码迷,mamicode.com
首页 > 其他好文 > 详细

1023 组个最小数

时间:2018-07-23 23:35:58      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:else   class   iostream   stream   mes   namespace   out   span   --   

 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main(){
 5     int a[10], s = 0;
 6     for (int i = 0; i < 10; i++){
 7         cin >> a[i];
 8         s += a[i];
 9     }
10     int *b = new int[s];
11     int f = 0;
12     for (int i = 1; i < 10; i++){
13         if (a[i] != 0){
14             b[f++] = i;
15             a[i]--;
16             break;
17         }
18     }
19     for (int i = 0; i < 10; i++){
20         while (1){
21             if (a[i] != 0){
22                 b[f++] = i;
23                 a[i]--;
24             }
25             else break;
26         }
27         
28     }
29     for (int i = 0; i < f; i++){
30         cout << b[i];
31     }
32     cout << endl;
33     return 0;
34 }

 

1023 组个最小数

标签:else   class   iostream   stream   mes   namespace   out   span   --   

原文地址:https://www.cnblogs.com/zb520/p/9357328.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!