diff --git a/utopian_tree/test.in b/utopian_tree/test.in new file mode 100644 index 0000000..b84706e --- /dev/null +++ b/utopian_tree/test.in @@ -0,0 +1,5 @@ +4 +1 +2 +3 +4 \ No newline at end of file diff --git a/utopian_tree/utopian_tree.py b/utopian_tree/utopian_tree.py new file mode 100644 index 0000000..28729fa --- /dev/null +++ b/utopian_tree/utopian_tree.py @@ -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() \ No newline at end of file