Maisie586_ @ 2024-05-21 20:49:35
a = input()
a = a[::-1]
if a[-1] == '-':
for i in a:
if i == '0':
a = str(a)[:-1]
a = 0 - int(a)
print(a)
break
else:
for i in a:
if i == '0':
a = int(a)
print(a)
by Justin_love_coding @ 2024-05-21 21:09:00
这里用python的人不多吧……
by DogYellow @ 2024-05-21 21:12:19
额--,你没设变量a
by Ghosty_Neutrino @ 2024-05-21 21:14:08
确实,我们都玩OI的
#include <bits/stdc++.h>
using namespace std;
int main(){
int a;
cin>>a;
int sum=0;
if(a>=0){
while(a!=0){
sum=sum*10+a%10;
a/=10;
}
cout<<sum;
}else{
a=a*-1;
while(a!=0){
sum=sum*10+a%10;
a/=10;
}
cout<<"-"<<sum;
}
return 0;
}
这c++版的,看看能不能改成python的