接水问题
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
有N个人提着不同大小的水桶来接水,因为水桶大小不同,每个桶接满的时间也各不相同。
现在问你,给你每个人接水需要的时间,如何安排接水,让所有人等待的时间最少。
1<=N<=1000。
Input Format
第一行一个整数 N 后面有N行,每行一个整数Ai(1<=A<=100),第i个人接满水需要的时间,单位是秒。
Output Format
所有人把桶接满,等待时间的累加和。
Sample
input
3
2
8
3
output
20 ( 先第一个人,再第三个,最后第二个)
Hint
时间限制:
空间限制:
20200817排序基本练习
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 9
- Start at
- 2020-8-17 9:36
- End at
- 2020-8-20 9:36
- Duration
- 72 hour(s)
- Host
- Partic.
- 26