AmazonOA #284
Minimum Days to Deliver Parcels
估计简单可在线判题
考点(AI 标注)哈希计数
Each day, choose a positive integer x and ship exactly x parcels from every center that still has parcels. x cannot exceed the current remaining amount of any non-empty center, and empty centers do not take part. Find the minimum number of days to ship all parcels. If everything is 0 at the start, the answer is 0 days.
输入格式
The first line contains n and the second line contains parcels. 1≤n≤1000000, 0≤parcels[i]≤10^9; the original million-sized range is kept.
输出格式
Output a single integer, the answer.
样例 1
输入:
5
2 3 4 3 3
输出:
3
样例 2
输入:
3
3 3 3
输出:
1
样例 3
输入:
2
0 0
输出:
0
样例说明
The answers are 3, 1 and 0 respectively. In the first example you can ship 2, 1 and then 1 parcels from every non-empty center.