1 solutions
-
0
#include<bits/stdc++.h> using namespace std; int a[11]; int main() { int n, m; cin >>n; for (int i = 0; i < n; i++){ cin >> m; a[m]++;//加入0~9下标数组计算个数 } string s; for(int i = 0; i <=9; i++){ for(int j = 0; j < a[i]; j++){ s += (i + '0'); } } if(s[0] == '0')//若首位为0,找到第一个不是0的数,交换 { int i =1; while(s[i] == '0') i++; swap(s[0],s[i]); } cout << s; return 0; }
- 1
Information
- ID
- 789
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- 10
- Tags
- # Submissions
- 5
- Accepted
- 3
- Uploaded By