atcoder#ARC143A. [ARC143A] Three Integers
[ARC143A] Three Integers
Score : points
Problem Statement
Three non-negative integers , , and are written on a blackboard. You can perform the following two operations any number of times in any order.
- Subtract from two of the written integers of your choice.
- Subtract from all of the written integers.
Your objective is to make all the numbers on the blackboard . Determine whether it is achievable. If it is, find the minimum number of times you need to perform an operation to achieve it.
Constraints
Input
Input is given from Standard Input in the following format:
Output
If the objective is unachievable, print -1
. If it is achievable, print the minimum number of times you need to perform an operation to achieve it.
2 2 3
3
Here is one way to make all the numbers .
- Subtract from and . Now the numbers are , , .
- Subtract from and . Now the numbers are , , .
- Subtract from all the numbers. Now the numbers are , , .
0 0 1
-1
0 0 0
0