11A - Increasing Sequence - CodeForces Solution


constructive algorithms implementation math *900

Please click on ads to support us..

Python Code:

a = []
n = input().split(' ')
d = int(n[1])
n = int(n[0])
x = input().split(' ')
k=0
for i in range(n):
    a.append(int(x[i]))
    if (i>0 and a[i-1] >= a[i]):
        k += ((a[i - 1] - a[i]) // d) + 1
        a[i] += ((a[i - 1] - a[i]) // d) * d + d
print(k)


Comments

Submit
0 Comments
More Questions

1191A - Tokitsukaze and Enhancement
903A - Hungry Student Problem
52B - Right Triangles
1712A - Wonderful Permutation
1712D - Empty Graph
1712B - Woeful Permutation
1712C - Sort Zero
1028B - Unnatural Conditions
735B - Urbanization
746C - Tram
1278B - A and B
1353D - Constructing the Array
1269C - Long Beautiful Integer
1076A - Minimizing the String
913C - Party Lemonade
1313A - Fast Food Restaurant
681A - A Good Contest
1585F - Non-equal Neighbours
747A - Display Size
285A - Slightly Decreasing Permutations
515C - Drazil and Factorial
1151E - Number of Components
1151F - Sonya and Informatics
556A - Case of the Zeros and Ones
867A - Between the Offices
1569A - Balanced Substring
260A - Adding Digits
1698C - 3SUM Closure
1029B - Creating the Contest
1421A - XORwice