You are viewing a single comment's thread. Return to all comments →
Did anyone try solving it this way? The output matches perfectly but the test cases tell me that the output is wrong...any suggestions?
Code in Python3:
n = int(input())
def growthCycle(x):
if x == 0: h = 1 elif x % 2 == 0: h = 2 ** ((x/2) + 1) - 1 elif x % 2 == 1: h = 2 ** ((x + 3)/2) - 2 return h
for l in (0, n):
g = int(input()) res = int(growthCycle(g)) print(res)
Seems like cookies are disabled on this browser, please enable them to open this website
Utopian Tree
You are viewing a single comment's thread. Return to all comments →
Did anyone try solving it this way? The output matches perfectly but the test cases tell me that the output is wrong...any suggestions?
Code in Python3:
n = int(input())
def growthCycle(x):
for l in (0, n):