Seasonal Tree Growth
The Utopian Tree grows on a schedule: in spring it doubles, and in summer it grows by one meter. Its starting height is 1. The function utopian_tree receives the number of growth cycles n: odd cycles double the height, and even cycles add 1. Return the tree’s height after all cycles.
Примеры
Ввод
0Вывод
1Ввод
1Вывод
2Ввод
4Вывод
7Нужно реализовать
def utopian_tree(n: int) -> int:
Теги
math
Влез, за да видиш историята на решенията
ВходВлез, за да използваш ИИ ментора
ВходVisible tests
1
Input
0Expected
12
Input
1Expected
23
Input
4Expected
74
Input
5Expected
145
Input
2Expected
36
Input
3Expected
6Focus radio
Paused · SomaFM · Fluid