-
Notifications
You must be signed in to change notification settings - Fork 6
/
725.cpp
46 lines (40 loc) · 1000 Bytes
/
725.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//Steven Kester Yuwono - UVa 725
#include <cstdio>
using namespace std;
int main(){
int counter=1;
bool visited=false;
int N;
scanf("%d",&N);
while(N!=0){
if(counter>1){
printf("\n");
}
counter++;
visited=false;
for (int fghij =1234; fghij <= 98765 / N ; fghij++){
int abcde = fghij *N;
int tmp;
int used = (fghij<10000);
tmp = abcde;
while(tmp){
used |= 1<< (tmp%10);
tmp/=10;
}
tmp = fghij;
while(tmp){
used |= 1<< (tmp%10);
tmp/=10;
}
if(used== (1<<10)-1){
printf("%0.5d / %0.5d = %d\n", abcde, fghij, N);
visited=true;
}
}
if(!visited){
printf("There are no solutions for %d.\n",N);
}
scanf("%d",&N);
}
return 0;
}