cswork / OA打开练习工作台

GreyOrangeOA #2

Array Operations

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)二分查找贪心调度

You are given an array of n elements and two variables, x and y. In each operation, you can: Subtract x from one element of the array. Subtract y from the remaining elements. Your task is to find the minimum number of operations required to make every element of the array ≤ 0. Input Format: The first line contains an integer n, the number of elements in the array. The second line contains n space-separated integers representing the array. The third line contains two integers, x and y, where x > y. Output: Print the minimum number of operations to make each element ≤ 0.

Example 1

Input:

arr = [10, 20, 30, 40, 50]
x = 5
y = 2

Output:

13

Explanation: To make every element ≤ 0, the minimum number of operations required is 13.