#include #include #include using namespace std;

int main() { int n, d; cin >> n >> d;

vector<int> b(n);
for(int i=0; i<n; i++) {
    cin >> b[i];
}

int moves = 0;
for(int i=1; i<n; i++) {
    if(b[i] <= b[i-1]) {
        int diff = b[i-1] - b[i];
        int add = diff / d + 1;
        b[i] += add * d;
        moves += add;
    }
}

cout << moves << endl;

return 0;

}

A sequence �0�1��−1a 0 a 1 a t−1 is called increasing if ��−1��a i−1 a i for each �0��i0it You are given a sequence �0�1��−1b 0 b 1 b n−1 and a positive integer �d In each move you may cho

原文地址: https://www.cveoy.top/t/topic/h8Pl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录