diff options
author | Ta180m | 2019-08-19 09:24:26 -0500 |
---|---|---|
committer | GitHub | 2019-08-19 09:24:26 -0500 |
commit | 06d0b05faa818ea9cb83ffba1874ffdaa973b408 (patch) | |
tree | 56f9c1e438d68a397e5ec904656516fe8187e90c | |
parent | 2f5d998595c239c6441f88cb5003f870b8f285f3 (diff) |
Update googol.py
-rw-r--r-- | 2015/US Open/Gold/googol.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/2015/US Open/Gold/googol.py b/2015/US Open/Gold/googol.py index 483fac8..5eeb3be 100644 --- a/2015/US Open/Gold/googol.py +++ b/2015/US Open/Gold/googol.py @@ -6,10 +6,7 @@ def solve(u, d): if d == -1: d = 2 * solve(a, -1) + 1 d = d - 1 - if d % 2 == 0: - return (d >> 1) + solve(b, (d >> 1)) + 1 - else: - return (d >> 1) + solve(a, (d >> 1) + 1) + 1 + return (d >> 1) + solve(a if d % 2 == 1 else b, (d >> 1) + (d % 2)) + 1 ans = solve(1, -1); print("Answer", ans); |