-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path33.py
51 lines (41 loc) · 1.12 KB
/
33.py
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
47
48
49
50
51
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
import time
#decorator that gets time of program
def dect(func):
def timef():
t0 = time.time()
func()
t1 = time.time()
print(t1 - t0)
return timef
@dect
def main():
prod_n = 1
prod_d = 1
for n in range(12,100):
if n % 10 == 0 or n % 11 == 0:
continue
#print("n: {}".format(n))
for d in range(n,100):
if any([d == n,
d % 10 == 0,
d % 11 == 0,]):
continue
#print("d: {}".format(d))
l_n = [digit
for digit in str(n)
if digit not in set(str(d))]
l_d = [digit
for digit in str(d)
if digit not in set(str(n))]
if len(l_n) != 1:
continue
mut_n = int("".join(l_n))
mut_d = int("".join(l_d))
if mut_n / mut_d == n / d:
prod_n *= mut_n
prod_d *= mut_d
print("{} / {}".format(prod_n,prod_d))
main()