Browse Source

Solved Utopian Tree

main
Titouan Rigoudy 11 years ago
parent
commit
af33d4221c
2 changed files with 21 additions and 0 deletions
  1. +5
    -0
      utopian_tree/test.in
  2. +16
    -0
      utopian_tree/utopian_tree.py

+ 5
- 0
utopian_tree/test.in View File

@ -0,0 +1,5 @@
4
1
2
3
4

+ 16
- 0
utopian_tree/utopian_tree.py View File

@ -0,0 +1,16 @@
#!/usr/bin/python3
import sys
def calcsize(cycles):
tmp = 2**((cycles+3)//2)
if cycles % 2 == 1:
return tmp - 2
return tmp - 1
def main():
total = int(sys.stdin.readline())
for i in range(total):
print(calcsize(int(sys.stdin.readline())))
main()

Loading…
Cancel
Save