dead000 @ 2023-09-27 11:09:45
#include<stdio.h>
#include<math.h>
int main()
{
int n;
scanf("%d",&n);
int i=1;
int l=abs(n);
int j=l;
while(j>0){
j/=10;
i*=10;
}
i/=10;
int sum;
while(l>0){
int k=l%10;
sum+=k*i;
l/=10;
i/=10;
}
if(n>=0){
printf("%d",sum);
}else{
printf("-%d",sum);
}
return 0;
}
by Z_X_D_ @ 2023-09-27 11:26:50
1.sum局部变量没初始化;
2.输入1e9时i会爆int
by dead000 @ 2023-09-27 12:16:46
@Z_XD 俺没听懂555
by dead000 @ 2023-09-27 12:21:10
@Z_XD 懂啦懂啦,谢谢佬