#P8808. [蓝桥杯 2022 国 C] 斐波那契数组
[蓝桥杯 2022 国 C] 斐波那契数组
Problem Description
If an array satisfies the following conditions, it is called a Fibonacci array:
- .
- .
- For all , .
Now, an array is given. You may perform any number of modifications. In each modification, you change the element at some position in the array to a positive integer greater than . What is the minimum number of elements that need to be modified so that array becomes a Fibonacci array.
Input Format
The first line contains an integer , representing the number of elements in array .
The second line contains integers , where adjacent integers are separated by one space.
Output Format
Output one line containing an integer, representing the minimum number of elements that need to be modified in array so that can become a Fibonacci array.
5
1 2 2 4 8
3
Hint
Sample Explanation
Modify the original array to . At least three elements need to be modified to make it a Fibonacci array.
Scale and Constraints of Test Cases
For all test cases, , .
Lanqiao Cup 2022 National Contest, Group C, Problem E.
Translated by ChatGPT 5