Problem C
Covered Walkway
Your university wants to build a new walkway, and they want at least part of it to be covered. There are certain points which must be covered. It doesn’t matter if other points along the walkway are covered or not.
The building contractor has an interesting pricing scheme.
To cover the walkway from a point at
Given the points along the walkway and the constant
Input
Input consists of a single test case. The test case will
begin with a line with two integers,
Output
Output a single integer, representing the minimum cost to
cover all of the specified points. All possible inputs yield
answers which will fit in a signed
Sample Input 1 | Sample Output 1 |
---|---|
10 5000 1 23 45 67 101 124 560 789 990 1019 |
30726 |