问题标题: 酷町堂:1214

0
0
已解决
黄子澄
黄子澄
中级天翼
中级天翼

#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iomanip>
using namespace std;
int main(){
    string a,b="";
    int c=1;
    cin>>a;
    sort(a.begin(),a.end());
    for(int i=0;i<a.length();i++){
        if(a[i]=='0'&&c==1){
            b+=a[i];
        }
        else if(c==1){
            cout<<a[i]+b;
            c=0;
        }
        else{
            cout<<a[i];
        }
    }
    return 0;
}


0
0
黄子扬
黄子扬
初级天翼
初级天翼

我觉得你的0处理的有问题

0
黄子澄
黄子澄
中级天翼
中级天翼

做对了,快来结帖啦!!!

0
0
李瑞曦
李瑞曦
高级天翼
高级天翼

"做对了,快来结帖啦!!!"

结贴吧~

0
0
我要回答