atcoder#ARC158A. [ARC158A] +3 +5 +7
[ARC158A] +3 +5 +7
Score : points
Problem Statement
You are given integers , , and . For these integers, you can perform the following operation any number of times, possibly zero.
- Choose a permutation of , that is, a triple of integers such that and .
- Then, simultaneously replace with , with , and with .
Your objective is to satisfy . Determine whether it is achievable. If it is, print the minimum number of times you need to perform the operation to achieve it.
You have test cases to solve.
Constraints
Input
The input is given from Standard Input in the following format:
Each test case is in the following format:
Output
Print lines. The -th line should contain the following value for the -th test case.
- The minimum number of times you need to perform the operation to satisfy , if it is possible to satisfy this.
- , otherwise.
4
2 8 8
1 1 1
5 5 10
10 100 1000
2
0
-1
315
For the first test case, you can do the following to satisfy .
- Perform the operation with , replacing with .
- Perform the operation with , replacing with .