#abc368b. B - Decrease 2 max elements
B - Decrease 2 max elements
Score : points
问题陈述
你得到了一个由 个正整数组成的序列 。高桥会重复以下操作,直到 中包含一个或更少的正元素:
- 将 按降序排序。然后,将 和 都减少 。
找出他执行这个操作的次数。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given a sequence of positive integers . Takahashi repeats the following operation until contains one or fewer positive elements:
- Sort in descending order. Then, decrease both and by .
Find the number of times he performs this operation.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
1 2 3 3
Sample Output 1
4
The process goes as follows:
- After the 1st operation, is .
- After the 2nd operation, is .
- After the 3rd operation, is .
- After the 4th operation, is . no longer contains more than one positive elements, so the process ends here.
Sample Input 2
3
1 1 100
Sample Output 2
2