没看题解自己写的,
#include<iostream>
using namespace std;
int n;
bool o;
int y = 0;
bool sf(int x, int w)/*判断是否为回文数*/
{
int a, b, c, d, e, f;
a = x % 10;
b = (x / 10) % 10;
c = (x / 100) % 10;
d = (x / 1000) % 10;
e = (x / 10000) % 10;
f = (x / 100000) % 10;
/*abcdef分别储存个位十位等数*/
if (x > 99999 && (a == f) && (b == e) && (c == d))
{
if ((a + b + c + d + e + f) == w)
{
y = 6;
return true;
}
}
if (x <= 99999 && (a == e) && (b == d))
{
if ((a + b + c + e + d) == w)
{
y = 6;
return true;
}
}