杨书蘅 • 6天前
using namespace std; int a[10];
int main() {
long long n;
cin >> n;
while (n != 0) {
int x = n % 10;
a[x]++;
n = n / 10;
}
for (int i = 1; i <= 9; i++) {
if (a[i] != 0) {
cout << i;
a[i]--;
break;
}
}
for (int i = 0; i <= 9; i++) {
if (a[i] != 0) {
while (a[i]--) {
cout << i;
}
}
}
return 0;
}
评论:
请先登录,才能进行评论