#P6426. Kangaroo Game on Number Line
Kangaroo Game on Number Line
Kangaroo Game on Number Line
There are three kangaroos playing on a number line in a desert. Each kangaroo occupies a distinct integer point. In each move, one of the kangaroos that is not the middle one jumps into a space between the other two kangaroos, ensuring that no two kangaroos ever occupy the same position.
Your task is to maximize the number of moves the kangaroos can make. It can be shown that the maximum number of moves is given by:
where \(a\), \(b\), \(c\) are the positions of the kangaroos sorted in increasing order.
inputFormat
The input consists of a single line containing three distinct integers separated by spaces, representing the positions of the kangaroos on the number line.
outputFormat
Output a single integer representing the maximum number of moves the kangaroos can make.
sample
2 5 8
2