#include <iostream> using namespace std; int a[5]; int b[5]; int main() { for(a[0]=1;a[0]<=9;a[0]++) for( a[1]=0;a[1]<=9;a[1]++) for( a[2] = 0; a[2] <= 9; a[2]++) for( a[3] = 0; a[3] <= 9; a[3]++) for( a[4] = 1 ;a[4] <= 9; a[4]++) { int x = a[0]*10000+a[1]*1000+a[2]*100+a[3]*10+a[4]; for(int i = 2; i <= 9; i++) { int y = x *i; int j = 0; int sign = 1; while(y!=0) { b[j] = y%10; y = y/10; if(b[j]!=a[j]) {sign=0;break;} j++; } if(sign) cout <<i << ‘ ‘ << b[4] <<b[3]<<b[2]<<b[1]<<b[0] << ‘ ‘<< a[0] << a[1] << a[2] << a[3] <<a[4]<< endl; } } system("pause"); return 0; }
时间: 2024-11-29 08:42:45