【例58.3】 电梯运行时间
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
The elevator takes seconds to go up one floor, seconds to go down one floor, seconds to open the door once (only if someone is arriving), and an additional second for each person to exit.
It is specifically noted that the elevator starts at the th floor and must return to the th floor to complete a task. Assuming that the floor each person in the elevator wants to go to is known at the start, can you calculate the total time required to complete this task?
Input Format
The first line contains a positive integer (), representing the number of people in the elevator.
The second line contains positive integers, (), representing the floor the -th person wants to go to.
Output Format
A single line containing a positive integer, representing the total time required to complete the task.
Sample
4
3 7 3 189
20251018C班作业(3)
- Status
- Done
- Problem
- 5
- Open Since
- 2025-10-23 0:00
- Deadline
- 2025-10-30 23:59
- Extension
- 24 hour(s)