#P10989. [蓝桥杯 2023 国 Python A/Java A] 等腰三角形
[蓝桥杯 2023 国 Python A/Java A] 等腰三角形
Background
Python users are recommended to submit this problem using PyPy3.
Problem Description
Given a sequence containing numbers, in each operation you may choose any number and change it by or .
We want to make this sequence satisfy the following condition: no matter which three numbers you choose from it, the three corresponding lengths can always form an isosceles triangle. Find the minimum number of operations needed to make the sequence satisfy this condition.
Input Format
The first line contains an integer .
The second line contains integers, representing , separated by a single space.
Output Format
Output one line containing an integer, representing the minimum number of operations.
5
3 3 5 7 7
3
Hint
For of the test cases, .
For of the test cases, .
For all test cases, .
Sample Explanation
You can modify the original sequence to .
Translated by ChatGPT 5