1 /**
2 Function: ()()()()x()=()()()()
3 Developer:
4 Date:
5
6 */
7
8 #include "iostream"
9 #include "cstdlib"
10 #include "string"
11 #include "cstdio"
12 #include "ctime"
13 #include "sstream"
14 using namespace std;
15 int main()
16 {
17 clock_t start = clock();
18 int s=0,k=0;
19 string a="",b;
20 char r;
21 for(int i=1200;i<5000;i++){
22 for(int j=2;j<=4;j++){
23 stringstream s1,s2,s3,s4;
24 a="";
25 s=i*j;
26 if(s>10000)
27 break;
28 else{
29 s1<<i;s1>>b;
30 a+=b;
31 s2<<j;s2>>b;
32 a+=b;
33 s3<<s;s3>>b;
34 a+=b;//转化为字符串
35 k=0;
36 if(a.find('0')==-1){//不含0
37 while(++k){//判断是否满足1-9条件
38 if(k==10)
39 break;
40 r=k+48;
41 if(a.find(r)==-1){//不含r
42 break;
43 }
44 }
45 }
46 if(k>=10)
47 cout<<i<<" * "<<j<<" = "<<s<<endl;
48 }
49 }
50 }
51 clock_t end1 = clock();
52 double duration=end1-start;
53 cout<<"算法耗时"<<duration<<"ms"<<endl;
54 system("pause");
55 }