summaryrefslogtreecommitdiff
path: root/033.py
blob: 9575983dafcf387e05ff74a6509d464c12c87d7a (plain)
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
def curious_fraction(a, b):
	a1 = a/10
	a2 = a%10
	b1 = b/10
	b2 = b%10

	result = 1.0*a/b;

	if a2 == 0 or b2 == 0:
		return False
	
	if a1 == b1 and 1.0*a2/b2 == result:
		return True
	
	if a1 == b2 and 1.0*a2/b1 == result:
		return True
	
	if a2 == b1 and 1.0*a1/b2 == result:
		return True
	
	if a2 == b2 and 1.0*a1/b1 == result:
		return True
	
	return False

product = 1.0

for a in range(10, 100):
	for b in range(a+1, 100):
		if curious_fraction(a, b):
			product *= 1.0*a/b

print int(1/product)