Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.
There is an array of size n. You will be given an integer x. In each move you have to subtract x or the minimum element of the array from all other elements of the array (Including the minimum element). If any element of the array becomes 0 or negative after each move then you will have to remove the number from the array.
You will have to delete all elements from the array with minimum number of moves.
The first line will consist of two integers n (1 ≤ n ≤ 1000) and x (0 ≤ x ≤ 100000). The second line will consist of n integer a1, a2, a3, ... an (0 ≤ ai ≤ 100000).
Output in a single line the minimum number of moves required.
Input | Output |
---|---|
5 4 8 1 2 7 5 | 2 |
66% Solution Ratio
fsshakkhorEarliest,
saquib2508Fastest, 0.0s
fsshakkhorLightest, 131 kB
touhidurShortest, 167B
Login to submit