https://leetcode-cn.com/problems/reverse-integer/
class Solution {
public:
int reverse(long long int x) {
bool flag=false;
if(x<0) flag=true,x=-x;
long long int ans=0;
while(x)
{
ans=ans*10+x%10;
x/=10;
}
if(flag) ans=ans*-1;
if((ans>pow(2,31)-1)||ans<(-1*pow(2,31))) return 0;//过界了
return ans;
}
};