#T653. 序列修改
序列修改
Description
Given a sequence {}, modify the minimum number of elements such that the sequence {} becomes an arithmetic sequence with a common difference of 1.
Input Format
Line 1: An integer N.
Line 2: N integers .
Output Format
An integer representing the minimum number of elements to be modified.
3
2 1 4
1
Hint
【Data Range and Constraints】
For 40% of the data, ;
For 100% of the data, , .
Source
CodesOnline