Little_Andyyu @ 2022-08-07 09:19:07
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a[11];
cin>>a;
int b=strlen(a);
if(a[0]=='-')
cout<<'-';
if(a[b]=='0')
b-=1;
for(int i=b;i>=0;i--)
cout<<a[i];
return 0;
}
by Dream_Creator @ 2022-08-07 09:26:13
@Little_Andyyu
#include<bits/stdc++.h>
using namespace std;
int main(){
char a[11];
cin>>a;
int b=strlen(a);
if(a[0]=='-') cout<<"-";
if(a[b-1]=='0') b-=1;
for(int i=b-1;i>=1;i--) cout<<a[i];
return 0;
}
by Dream_Creator @ 2022-08-07 09:26:41
@Little_Andyyu 好像还是WA……
by 上帝之鹰 @ 2022-08-07 09:35:43
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,num=0;
short x[10];
bool flag=true;
cin>>n;
if(n<0){
cout<<"-";
n=-n;
}
if(n==0)
cout<<0;
while(n>0){
x[num++]=n%10;
n/=10;
}
num--;
for(int i=0;i<=num;i++){
if(flag&&x[i]==0)
continue;
flag=false;
cout<<x[i];
}
return 0;
}