考虑到人塔将在舞台上进行,并且舞台有最大重量限制。 编写一个python程序,求出底层的最大人数,使塔楼的总重量不超过舞台的最大重量限制。 假设:
每一级的人数减少2人。你知道吗
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):
pass
max_people = find_maximum_people(1000)
print(max_people)
相关问题 更多 >
编程相关推荐