summaryrefslogtreecommitdiff
path: root/033.py
diff options
context:
space:
mode:
Diffstat (limited to '033.py')
-rw-r--r--033.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/033.py b/033.py
new file mode 100644
index 0000000..9575983
--- /dev/null
+++ b/033.py
@@ -0,0 +1,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)
+