Minimum increments
Very easy
Execution time limit is 3 seconds
Runtime memory usage limit is 128 megabytes
Given array with positive integers. Find the minimum number of operations required so that an Arithmetic Progression with the array elements is achieved with common difference as . In a single operation, any element can be incremented by .
Input
First line contains number . Second line contains positive integers, each is no more than .
Output
Print the minimum number of operations to get an Arithmetic Progression with common difference as .
Examples
In the first test array must be converted to . In this case we'll make operations.
Input #1
Answer #1
Input #2
Answer #2
Submissions 1K
Acceptance rate 36%