Topic:
Ideas:
Use I and J to represent two multipliers, and then determine if two times are available
Code:
#include <stdio.h> #include <string.h> #include <string> #include <iostream> #include <stack > #include <queue> #include <vector> #include <algorithm> #define MEM (a,b) memset (A,b,sizeof (a)) #
Define N 1000+20 #define INF 0x3f3f3f3f #define M 1000000+2000 #define LL long using namespace std;
int num[100];
int judge (int x)//is judged to be more than two times {while (x) {num[x%10]++;
if (NUM[X%10]>2) return 0;
x/=10;
return 1; int main () {for (int i=100;i<=999;i++) {for (int j=100;j<=999;j++) {mem (num,0
);
int a=i* (J%10);
int b=i* (J/10%10);
int c=i* (J/100%10);
int s=i*j; if (a>999| | b>999| | c>999| | a<100| | b<100| | c<100| | s>99999| |
s<10000) continue;
if (judge (a) &&judge (b) &&judge (c) &&judge (s) &&judge (i) &&judge (j)) printf ("%d\n", s);
} return 0; }