80分求助
查看原帖
80分求助
865793
better_Z楼主2023/6/27 22:21
#include<iostream>
using namespace std;
int main(){
    const int maxn=1e9+5;
    char a[maxn];
    int i=1;
    while(cin>>a[i]){
        i++;
    }
    i--;
    int d=i;
    if(a[1]=='-'){
        cout<<'-';
        while(i>1){
            if(a[i]=='0'&&i==d){i--;continue;}
            cout<<a[i];
            i--;
        }
    }
    else{
        while(i>0){
            if(a[i]=='0'&&i==d){i--;continue;}
            cout<<a[i];
            i--;
        }
    }
    return 0;
}
2023/6/27 22:21
加载中...