bool isPalindrome(int x) {
if(x < 0)
return false;
long long num = (long long)x; //使用long long型变量防止反转时越界
long long test = 0;
while(num)
{
test = test * 10 + num % 10;
num /= 10;
}
if(x == test)
return true;
else
return false;
}
if(x < 0)
return false;
long long num = (long long)x; //使用long long型变量防止反转时越界
long long test = 0;
while(num)
{
test = test * 10 + num % 10;
num /= 10;
}
if(x == test)
return true;
else
return false;
}