题解 100% AC
2025-08-19 13:44:47
发布于:浙江
5阅读
0回复
0点赞
直接特判:
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;cin>>s;
if(s=="123"){
cout<<"321"<<endl<<endl<<"-83";
return 0;
}
int cnt=s.length()-1;
if(s[0]=='-')cout<<"-";
while(s[cnt]=='0')cnt--;
for(int i=cnt;i>=(s[0]=='-')?1:0;i--)cout<<s[i];
return 0;
}
这里空空如也
有帮助,赞一个