#K61307. Taco List Manipulation Challenge
Taco List Manipulation Challenge
Taco List Manipulation Challenge
You are given a list of integers. Your task is to manipulate the list in one of two ways based on the following rules:
- Calculate the sum of all odd integers in the list, denoted by \( S_{odd} = \sum_{i \, \text{is odd}} a_i \).
- Calculate the product of all even integers in the list. When an element is 0, treat it as 1 in the product calculation. Denote it by \( P_{even} \).
If \( S_{odd} > P_{even} \), output the list in reverse order. Otherwise, for every even integer, output its double, and for every odd integer, output half of its value (using standard division so that the result may be a floating point number).
Note: Use standard input/output for reading and printing data.
inputFormat
The input is given via standard input. The first line contains an integer \( T \) which indicates the number of test cases. For each test case, the first line contains an integer \( N \) denoting the number of elements, followed by a line with \( N \) space-separated integers.
outputFormat
For each test case, print the manipulated list on a separate line. The elements should be separated by a single space. Ensure that floating point values are printed in standard decimal notation.
## sample2
5
1 2 3 4 5
4
10 1 3 5
5 4 3 2 1
20 0.5 1.5 2.5
</p>