Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Dec 21, 2023
1 parent 0ec711f commit 1419983
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/numbertree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
items = input().split()
if len(items) == 2:
h, s = items
else:
h, s = items[0], ""

total, i = 2 ** (int(h) + 1), 1

for c in s:
i *= 2
if c == "R":
i += 1

print(total - i)

0 comments on commit 1419983

Please sign in to comment.