#P11A. Increasing Sequence

Increasing Sequence

Increasing Sequence

题面翻译

题面描述

把数列中一个数加上 dd 算作一次操作,求最少几次操作能把这个数列变为递增数列。

输入格式

输入共 22 行。

第一行 22 个整数 nnddnn 表示数列中数的数量,dd 含义如题目所示。

第二行 nn 个整数,表示原始数列。

输出格式

一行一个整数 mm,表示最少 mm 次操作能把这个数列变为递增数列。

题目描述

A sequence a0,a1,...,at1 a_{0},a_{1},...,a_{t-1} is called increasing if ai1<ai a_{i-1}<a_{i} for each i:0<i<t i:0<i<t .

You are given a sequence b0,b1,...,bn1 b_{0},b_{1},...,b_{n-1} and a positive integer d d . In each move you may choose one element of the given sequence and add d d to it. What is the least number of moves required to make the given sequence increasing?

输入格式

The first line of the input contains two integer numbers n n and d d ( 2<=n<=2000,1<=d<=106 2<=n<=2000,1<=d<=10^{6} ). The second line contains space separated sequence b0,b1,...,bn1 b_{0},b_{1},...,b_{n-1} ( 1<=bi<=106 1<=b_{i}<=10^{6} ).

输出格式

Output the minimal number of moves needed to make the sequence increasing.

样例 #1

样例输入 #1

4 2
1 3 3 2

样例输出 #1

3