Sub array quest IX


Description

Given an array A with N positive integers. Count the number of subarrays, such that for each subarray, the sum of odd numbers exceeds the sum of even 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

9

Hint

Given test cases,

Test 1:
N = 5.
A: 1 2 3 4 5.
The following subarrays having more sum of odd numbers than the sum of even numbers :
1. 1
2. 1 2 3
3. 1 2 3 4 5
4. 2 3
5. 2 3 4 5
6. 3
7. 3 4 5
8. 4 5
9. 5

Hence the answer is 9.


Answer: 

Comments

Popular posts from this blog

Multer file upload and delete - Nodejs, Mongodb, Express

Money Management