bool isPalindrome(int x) { string s=to_string(x); //将x转化为字符串 return s==string(s.rbegin(),s.rend()); 反转字符串s }