#abc369a. A - 369
A - 369
Score : points
问题陈述
给定两个整数 和 。
有多少个整数 满足以下条件?
- 条件:可以以某种顺序排列这三个整数 、 和 以形成一个等差数列。
如果三个整数 、 和 按照这个顺序排列,那么它们构成一个等差数列,当且仅当 等于 。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given two integers and .
How many integers satisfy the following condition?
- Condition: It is possible to arrange the three integers , , and in some order to form an arithmetic sequence.
A sequence of three integers , , and in this order is an arithmetic sequence if and only if is equal to .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the number of integers that satisfy the condition in the problem statement. It can be proved that the answer is finite.
Sample Input 1
5 7
Sample Output 1
3
The integers all satisfy the condition as follows:
- When , for example, arranging forms the arithmetic sequence .
- When , for example, arranging forms the arithmetic sequence .
- When , for example, arranging forms the arithmetic sequence .
Conversely, there are no other values of that satisfy the condition. Therefore, the answer is .
Sample Input 2
6 1
Sample Output 2
2
Only and satisfy the condition.
Sample Input 3
3 3
Sample Output 3
1
Only satisfies the condition.