Questions - climbing stairs

topic:

Sigma Microsoft Asia Research Institute building where a total of 6 lifts. In peak times, there are people up and down each floor, the elevator stops at every floor. Interns are often confused boats have stopped the elevator on each floor very impatient, so he proposed such an approach:
As the floor did not look too busy in working hours, each elevator from one floor up travel time, we only allow the elevator stopped at a certain level therein. After all the passengers from the elevator upstairs, reach a certain floors, elevators stop, then climb the stairs all the passengers from here to their destination floor. When the first floor, each passenger to select their own destination floor, the elevator should stop automatically calculated floor.

problem:

Elevator stopped at the floor which can guarantee a minimum number of layers and take the elevator all the passengers climb stairs.

Extended:

1. How complete complexity of O (n) time?
2. climb stairs, go down than to be always tired. Assume climb one floor, energy-consuming units k, and go down only takes 1 unit of energy, so if the title was changed to make the conditions of minimum energy consumption for all, the question how to solve it?
This problem can be analyzed using similar methods to answer the above view, so I no longer tired, leaving the reader to solve.
3. In a high-rise inside the elevator only stops at a certain floor, this policy is not very user-friendly. If the elevator stops at the k-th floor it? Readers can use your imagination to see how to find the optimal solution.

Guess you like

Origin www.cnblogs.com/Canace22/p/11276957.html