#include <stdio.h>
int main() { int n, num; int a, b, c, d, e, f; scanf("%d", &n); for (num = 10000; num <= 99999; num++) { a = num / 10000; b = num % 10000 / 1000; c = num % 1000 / 100; d = num % 100 / 10; e = num % 10; if (a == e && b == d && a + b + c + d + e == n) printf("%d\n", num); } for (; num <= 999999; num++) { a = num / 100000; b = num % 100000 / 10000; c = num % 10000 / 1000; d = num % 1000 / 100; e = num % 100 / 10; f = num % 10; if (a == f && b == e && c == d && a + b + c + d + e + f == n) printf("%d\n", num); } return 0; }
|