#C11197. Alice and Bob's Even-Odd Selection
Alice and Bob's Even-Odd Selection
Alice and Bob's Even-Odd Selection
Problem Statement
Alice loves even numbers while Bob prefers odd numbers. Given several test cases, each containing a sequence of integers, your task is to help them by selecting the numbers they like.
For each test case, count the number of even integers (which Alice will select) and the number of odd integers (which Bob will select). Print the result for each test case on a new line.
In mathematical terms, for a given sequence \(a_1, a_2, \dots, a_N\), you are to compute:
\[ \text{Evens} = \sum_{i=1}^{N} \mathbf{1}_{\{a_i \text{ mod } 2 = 0\}}, \quad \text{Odds} = N - \text{Evens} \]Process the input efficiently from stdin
and print your output to stdout
.
inputFormat
The input is read from standard input (stdin
) and is structured as follows:
- The first line contains an integer T, the number of test cases.
- For each test case:
- The first line contains an integer N, the number of integers in the sequence.
- The next line contains N space-separated integers.
outputFormat
For each test case, print a single line containing two space-separated integers:
- The first integer is the count of even numbers (Alice’s selection).
- The second integer is the count of odd numbers (Bob’s selection).
The output should be written to standard output (stdout
).
1
3
2 4 6
3 0