lyc201204 @ 2024-01-10 20:42:23
#include<bits/stdc++.h>
using namespace std;
signed main(){
string s;
cin>>s;
if(s[0]=='-'){
cout<<"-";
for(int i=s.size()-1;i>=1;i--)
if(s[i]=='0') continue;
else cout<<s[i];
}
else{
for(int i=s.size()-1;i>=0;i--)
if(s[i]=='0') continue;
else cout<<s[i];
}
puts("");
return 0;
}
70分,错哪了
by xiaoshumiao @ 2024-01-10 20:49:54
@fish_hate_cat
HACK:
308
您输出:
83
by lyc201204 @ 2024-01-10 23:44:11
@xiaoshumiao 怎么改dalao
by xiaoshumiao @ 2024-01-11 10:25:18
@fish_hate_cat
#include<bits/stdc++.h>
using namespace std;
signed main(){
string s;
cin>>s;
if(s=="0") {puts("0");return 0;}
bool flag=true;
if(s[0]=='-'){
cout<<"-";
for(int i=s.size()-1;i>=1;i--)
if(s[i]=='0'&&flag) continue;
else cout<<s[i],flag=false;
}
else{
for(int i=s.size()-1;i>=0;i--)
if(s[i]=='0'&&flag) continue;
else cout<<s[i],flag=false;
}
puts("");
return 0;
}
这样一旦碰到了不是