Division
1 #include <cstdio>
2 #include <iostream>
3 #include <queue>
4 #include <vector>
5 #include<string.h>
6 #include<map>
7 #include<bits/stdc++.h>
8 using namespace std;
9 int vis[10];
10 int main()
11 {
12 int n,ok=0;
13 int a,b,c,d,e,f,g,h,m,l,j;
14 while(scanf("%d",&n),n)
15 {
16 if(ok==0)
17 ok=1;
18 else
19 printf("
");
20 int sum=0;
21 for(int i=1234;i<=98765;i++)
22 {
23 memset(vis,0,sizeof vis);
24 a=i%10,b=i/10%10,c=i/100%10,d=i/1000%10,e=i/10000%10;
25 int num=i*n;
26 if(num>98765)break;
27 f=num%10,g=num/10%10,h=num/100%10,l=num/1000%10,m=num/10000%10;
28 vis[a]++,vis[b]++,vis[c]++,vis[d]++,vis[e]++;
29 vis[f]++,vis[g]++,vis[h]++,vis[l]++,vis[m]++;
30 for(j=0;j<=9;j++)
31 if(vis[j]>1)break;
32 if(j==10){
33 printf("%05d / %05d = %d
",num,i,n);
34 sum++;}
35 }
36 if(!sum)printf("There are no solutions for %d.
",n);
37 }
38 return 0;
39 }