CF11A.Increasing Sequence
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A sequence a0,a1,...,at−1 is called increasing if ai−1<ai for each i:0<i<t .
You are given a sequence b0,b1,...,bn−1 and a positive integer d . In each move you may choose one element of the given sequence and add 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 and d ( 2<=n<=2000,1<=d<=106 ). The second line contains space separated sequence b0,b1,...,bn−1 ( 1<=bi<=106 ).
输出格式
Output the minimal number of moves needed to make the sequence increasing.
输入输出样例
输入#1
4 2 1 3 3 2
输出#1
3