#K59122. Find Hidden Message
Find Hidden Message
Find Hidden Message
You are given several test cases. In each test case, you are provided with a list of integers. The task is to find the hidden message for each test case by applying the following rule:
If the number of integers \( n \) is odd, the hidden message is the middle element, i.e., the element at index \(\lfloor n/2 \rfloor\). If \( n \) is even, then the hidden message is defined as the sum of the two middle elements, i.e., the elements at indices \(\frac{n}{2}-1\) and \(\frac{n}{2}\).
Process each test case independently and print the resulting hidden message on a separate line.
inputFormat
The input is given via standard input (stdin) and follows the format below:
T line_1 line_2 ... line_T
Where:
- T is an integer indicating the number of test cases.
- Each line_i contains a list of space-separated integers representing a test case.
Note: There is no additional integer specifying the number of elements for each test case. You should determine \( n \) by counting the numbers in each line.
outputFormat
For each test case, output the hidden message on a separate line by using standard output (stdout).
If a test case contains an odd number of integers, output the middle element. If it contains an even number of integers, output the sum of the two middle elements.
## sample3
10 20 30 40 50
5 15 25 35 45 55
71
30
60
71
</p>