diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2014-08-31 20:21:45 +0200 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2014-08-31 20:35:09 +0200 |
| commit | 95341b61b030c9e1290f3b326cb7ec584f543aea (patch) | |
| tree | 852386fa04d32eb859bca11c0eff7b5ef9e50f00 /033.py | |
| parent | 571164d977f91925c4c76a292f74f5f93d09ae23 (diff) | |
Diffstat (limited to '033.py')
| -rw-r--r-- | 033.py | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -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) + |
