bool isPalindrome(int x) {
if(x==0)return true;
if(x < 0 || !(x%10))return false;
int fs = 0;
int ft = x;
while(ft>fs){
fs*=10;
fs+=ft%10;
ft/=10;
}
return (fs == ft || fs/10 == ft);
}

posted on 2017-12-14 17:44  朽木の半夏  阅读(80)  评论(0编辑  收藏  举报