Constantly enumerate the divisor can, water is very, pay attention to determine the cycle conditions.
The specific code is as follows:
#include<cstdio>
#include<iostream>
using namespace std;
int main() {
int n, t = 0;
while (scanf("%d", &n) && n) {
if (t++) printf("\n");
bool flag2 = true;
for (int i = 1234; i != 50000; ++i) {
int a[10] = {0};
++a[i % 10];
++a[i / 10 % 10];
++a[i / 100 % 10];
++a[i / 1000 % 10];
++a[i / 10000];
int x = i * n;
if (x > 99999) break;
++a[x % 10];
++a[x / 10 % 10];
++a[x / 100 % 10];
++a[x / 1000 % 10];
++a[x / 10000];
bool flag = true;
Span class= "KWD" >for ( int J = 0 J != 10 ; ++ j ) {
if (a[j] > 1) flag = false;
}
if (flag) {
flag2 = false;
Span class= "KWD" >if ( i < 10000 printf ( "%d/0%d =%d\n" x i n
else printf("%d / %d = %d\n", x, i, n);
}
}
if (flag2) printf("There are no solutions for %d.\n", n);
}
return 0;
}
From for notes (Wiz)
UVa 725 Division