擅长:python、mysql、java
<pre><code> #this funtion return the weight of the tower
def human_pyramid(no_of_people):
if (no_of_people == 1):
return 1 * (50)
else:
return no_of_people * (50) + human_pyramid(no_of_people - 2)
def find_maximum_people(max_weight):
i=1
while i<(max_weight//50):
current_weight=human_pyramid(i)
if current_weight>max_weight:
return i-1
#when the weight exceed this means older value was in the limit
i=i+2
max_people = find_maximum_people(1000)
print(max_people)
</code></pre>