#K91097. Fibonacci Guitar Tensions
Fibonacci Guitar Tensions
Fibonacci Guitar Tensions
You are given three integers representing the tensions of guitar strings. Your task is to determine whether there exists a permutation of these three integers that can form the first three numbers of a Fibonacci sequence. In a Fibonacci sequence, the largest number must equal the sum of the other two numbers, i.e., if the numbers (in sorted order) are \(a \leq b \leq c\), then they form a Fibonacci sequence if and only if \(c = a + b\). If such a permutation exists, output the largest tension; otherwise, output -1.
Note: The input is provided via the standard input and the output should be printed to the standard output.
inputFormat
The input consists of a single line containing three space-separated integers representing the guitar string tensions.
outputFormat
Output a single integer: the highest tension in the Fibonacci sequence if a valid permutation exists, or -1 if it does not.
## sample1 1 2
2