Throwing the fattest people off of an overloaded airplane.

后端 未结 12 1738
迷失自我
迷失自我 2020-12-04 04:42

Let\'s say you\'ve got an airplane, and it is low on fuel. Unless the plane drops 3000 pounds of passenger weight, it will not be able to reach the next airport. To save t

12条回答
  •  臣服心动
    2020-12-04 05:22

    You could make one pass over the list to get the mean and the standard deviation, then use that to approximate the number of people that have to go. Use partial_sort to generate the list based on that number. If the guess was low, use partial_sort again on the remainder with a new guess.

提交回复
热议问题