Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 734c101

Browse files
authored
Solution
1 parent a10121a commit 734c101

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the utopianTree function below.
10+
def utopianTree(n):
11+
boolean = False
12+
count=0
13+
for i in range(n+1):
14+
if(boolean == False):
15+
count+=1
16+
boolean = True
17+
else:
18+
count*=2
19+
boolean=False
20+
return count
21+
22+
if __name__ == '__main__':
23+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
24+
25+
t = int(input())
26+
27+
for t_itr in range(t):
28+
n = int(input())
29+
30+
result = utopianTree(n)
31+
32+
fptr.write(str(result) + '\n')
33+
34+
fptr.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /