Sub array quest VIII
Description
Given an array A with N positive integers. Count the number of subarrays, such that for each subarray, the number of even numbers exceeds the number of odd numbers.
Input
First line: Single integer denoting the value of T - the number of test cases.
For each test case:
First line: Single integer denoting the value of N.
Next line: N single space-separated integers denoting the elements of array A.
Constraints:1 <= T <= 100
1 <= N<= 100
Any array elements is not greater than 100.
Output
For each test case, print in a new line, a single integer denoting the number of subarrays.
Hint
Given test cases,
Test 1:
N = 5.
A: 1 2 3 4 5.
The following subarrays have a lesser number of odd numbers than even numbers :
1. 2
2. 2 3 4
3. 4
Hence the answer is 3.
Comments
Post a Comment