Underwood and Secretary of State

3.3

29 votes
Very-Easy
Problem

Frank Underwood is running for secretary of state but is not recognized as the favourite for the seat. Underwood's office has the data regarding each congressmen i.e. depending on whether the congressmen wants Underwood to be secretary of state or not. Given an array of integers, which represents data of each congressmen, you have analysed that if sum of three consecutive elements in the array lies in the range [x , y] (both inclusive), Underwood's chances of winning increase by one. You have to find Underwood's chances of winning, given that initially his chances are zero.

Input format

First line takes an integer T, the number of test cases as input.

First line of each test case contains three space separated integers N, x and y, representing the array size and range starting and ending point .

Second line of each test case contains N space separated integers, the data of each congressmen.

Output format

For each test case print Underwood's chances of winning in different line.

Constraints

1 <= T <= 1000

1 <= N <= 1000

-1000 <= Array element Ai <= 1000

-1000 <= x <= y <= 1000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Test Case 1: Sum of elements at index (0,1,2) and index (2,3,4) lies within the range 1 to 10 hence the output is 2

Test Case 2: No consecutive triplet is present such that the sum lies within the range -5 to 6 hence the output is 0

Editor Image

?