Building Pyramids
This commit is contained in:
9
pyramids.py
Normal file
9
pyramids.py
Normal file
@@ -0,0 +1,9 @@
|
||||
blocks_available = int(input())
|
||||
total_blocks_needed = 0
|
||||
i = 0
|
||||
while True:
|
||||
i += 1
|
||||
total_blocks_needed += (i * 2 - 1) ** 2
|
||||
if total_blocks_needed > blocks_available:
|
||||
print(i - 1)
|
||||
exit()
|
||||
Reference in New Issue
Block a user