#P9955. Decoding the Secret Triple
Decoding the Secret Triple
Decoding the Secret Triple
Farmer John's cows are having their daily meeting on the "mooZ" video conferencing platform, and to add some fun, Elsie has invented a simple number game. Elsie has three positive integers \(A\), \(B\), and \(C\) (with \(A\le B\\le C\)). These numbers are kept secret, and she does not reveal them directly to her sister Bessie. Instead, Elsie provides Bessie with seven integers (each between 1 and \(10^9\), not necessarily distinct) which are a permutation of the set \(\{A,\, B,\, C,\, A+B,\, B+C,\, A+B+C\}\). Given the seven numbers, help Bessie determine the values of \(A\), \(B\), and \(C\). It can be proven that the answer is unique.
Hint: If you sort the seven numbers in increasing order, the largest number will be \(A+B+C\), while the smallest two numbers are \(A\) and \(B\). Using these, you can compute \(C = (A+B+C) - A - B\).
inputFormat
The input consists of a single line with seven space-separated integers.
outputFormat
Output three space-separated integers: \(A\), \(B\), and \(C\).
sample
1 3 4 7 8 10 11
1 3 7