本文最后更新于 2181 天前,其中的信息可能已经有所发展或是发生改变。
#include<iostream>
using namespace std;
int main(){
for(int a=1;a<10;a++){
for(int b=0;b<10;b++){
for(int c=0;c<10;c++){
for(int d=0;d<10;d++){
for(int e=1;e<10;e++){
for(int f=0;f<10;f++){
for(int g=0;g<10;g++){
//b
for(int h=0;h<10;h++){
if(a!=b&&a!=c&&a!=d&&a!=e&&a!=f&&a!=g&&a!=h
&&b!=c&&b!=d&&b!=e&&b!=f&&b!=g&&b!=h
&&c!=d&&c!=e&&c!=f&&c!=g&&c!=h
&&d!=e&&d!=f&&d!=g&&d!=h
&&e!=f&&e!=g&&e!=h
&&f!=g&&f!=h
&&g!=h
&&
(a*1000+b*100+c*10+d+e*1000+f*100+g*10+b)
==
(e*10000+f*1000+c*100+b*10+h)){
cout<<a*1000+b*100+c*10+d<<endl;
cout<<e*1000+f*100+g*10+b<<endl;
cout<<e*10000+f*1000+c*100+b*10+h<<endl<<endl;
}
}
}
}
}
}
}
}
}
return 0;
}