#include <iostream> using namespace std; int reverse(int n) { int t = n; int count = 0; while (t) { count++; t /= 10; } t = n; int a[count]; for (int i = 0; i < count; i++) { a[i] = t % 10; t /= 10; } t = 0; for (int i = 0; i < count; i++) { t += a[i]; t *= 10; } return t / 10; } int main() { bool flag = false; for (int i = 1000; i < 10000; i++) { if (i * 9 == reverse(i)) { cout << i << endl; flag = true; } } if (!flag) cout << "无" << endl; } // 64 位输出请用 printf("%lld")