// 用字符串(题目禁止)
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0) return false;
string s = to_string(x);
return s == string(s.rbegin(), s.rend());
}
};
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0) return false;
int tmp = x;
long long res = 0;
while(tmp){
res = res * 10 + tmp % 10;
tmp = tmp / 10;
}
if(res == x) return true;
else return false;
}
};