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.

Sample Input 1 

1
5
1 2 3 4 5

Sample Output 1

3

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.



Answer:

Comments

Popular posts from this blog

Multer file upload and delete - Nodejs, Mongodb, Express

Money Management

Sub array quest IX