20070916lc @ 2021-08-13 13:53:22
#include <bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c=0,d=0;
cin>>a;
if(a<0) cout<<"-",b=-a;
int s[100];
while(b>0){
c++;
s[c]=b%10;
b=b/10;
}
for(int i=c;i>=1;i--){
int k=1;
for(int u=i+1;u<=c;u++){
k=k*10;
}
d+=k*s[i];
}
cout<<d;
return 0;
}
by _l_l_l_l_l_ @ 2021-08-13 13:54:48
@20070916lc 用不着这么麻烦读入string 倒着输出
by Albert_van @ 2021-08-13 13:55:12
@20070916lc 您的
by sss_t @ 2021-08-13 13:55:21
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int m=0,n,a;
cin>>n;
if(n%10==0)
{
n=n/10;
}
if(n<0)
{
cout<<"-";
n=abs(n);
}
while(n!=0)
{
a=n%10;
m=m*10+a;
n/=10;
}
cout<<m;
}
by Ew_Cors @ 2021-08-13 13:55:30
@WenZKbb 看题了吗?
by _l_l_l_l_l_ @ 2021-08-13 13:57:30
@Ew_Cors 加个特判
by 20070916lc @ 2021-08-13 13:59:30
谢谢已关注