AmazonOA #255
Make Array Zero by Subtracting Equal Amounts (LC 2375 :)
估计简单可在线判题
考点(AI 标注)哈希计数
In a non-negative array, each step chooses a positive integer x no greater than the current smallest non-zero element and subtracts x from every positive element; elements equal to 0 stay 0. Find the minimum number of steps to make every element zero.
输入格式
The first line contains n; the second line contains the array. 1≤n≤100, 0≤element≤100.
输出格式
Output a single integer, the answer.
样例 1
输入:
5
1 5 0 3 5
输出:
3
样例 2
输入:
1
0
输出:
0
样例 3
输入:
3
2 2 2
输出:
1
样例说明
The answers are 3, 0 and 1. Repeated equal positive values reach zero in the same operation.