Problem Description:
123321 is a very special number, it is read and read from the right as from the left.
Enter a positive integer n, find all such programming five and six decimal numbers, figures and meet all equal to n.
Input formats:
Input line, contains a positive integer n.
Output formats:
In ascending order of the output integer satisfying the condition, one row each integer. ,
Data size and the convention:
1<=n<=54。
Programming:
#include<cstdio>
int main() {
int n;
scanf("%d",&n);
int a,b,c,d,e,f;
for (int i = 10000; i <= 999999; i++) {
if (i <= 100000) {
a = i/10000;
b = i%10000/1000;
c = i%1000/100;
d = i%100/10;
e = i%10;
if (a == e && b == d && a+b+c+d+e == n) printf("%d\n",i);
}
else {
a = i/100000;
b = i%100000/10000;
c = i%10000/1000;
d = i%1000/100;
e = i%100/10;
f = i%10;
if (a == f && b == e && c == d && a+b+c+d+e+f == n) printf("%d\n",i);
}
}
return 0;
}