cswork / OA打开练习工作台

AmazonOA #226

Get Minimum Boxes

估计中等可在线判题

考点(AI 标注)双指针滑窗原地数组

Unload some boxes, keeping at least one, so that the kept sizes satisfy max≤capacity*min. Find the minimum number of boxes unloaded.

输入格式

The first line contains n capacity; the second line contains the sizes. The original text gives 1≤n≤100000 and 1≤size≤500000; the range of capacity is missing, and this site specifies a positive integer 1≤capacity≤10^9.

输出格式

Output a single integer, the answer.

样例 1

输入:

4 3
1 2 3 9

输出:

1

样例 2

输入:

3 1
2 2 3

输出:

1

样例 3

输入:

1 1
500000

输出:

0

样例说明

The answers are 1, 1 and 0; a ratio exactly equal to the limit is also valid.