反序相等(c++)
#include<iostream>
using namespace std;
int main()
{
for (int num = 1000; num <= 9999; num++) {
int a = num/1000;
int b = (num%100)/100;
int c = (num%100)/10;
int d = num%10;
int tmp = d*1000 + c*100 + b*10 + a;
if (num*9 == tmp)
cout << num << endl;
}
}
登录后发布评论
暂无评论,来抢沙发