#include "iostream.h"
#include "string.h"
#include "stdio.h"
bool isLxx(long num)
{
char ch[200] = {0};
int lens = 0;
sprintf(ch, "%d", num);
lens = strlen(ch);
for (int i = 0; i < lens / 2 + 1; i++)
{
if (ch[i] != ch[lens-i-1])
{
return false;
}
}
return true;
}
int coverLxx(long num)
{
long ret = 0;
long temp = num;
while(0 != num)
{
ret *= 10;
ret += num % 10;
num /= 10;
}
return ret;
}
void main()
{
long i;
while(cin>>i)
{
if (isLxx(i))
{
cout<<"yes"<<endl;
}
else
{
cout<<"no"<<endl;
cout<<coverLxx(i)<<endl;
}
}
}
小米笔试第一题:回文数
最新推荐文章于 2024-09-13 23:06:06 发布