This website works better with JavaScript.
Home
Explore
Help
Sign In
titouan
/
hackerrank
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
Solved Utopian Tree
main
Titouan Rigoudy
11 years ago
parent
a37e5d26af
commit
af33d4221c
2 changed files
with
21 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+5
-0
utopian_tree/test.in
+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
(
)
Write
Preview
Loading…
Cancel
Save