(RankList for this Question)
One day you were calculating the sum of all possible subarrays of the given array. But your mischievous friend came and shuffled all the integers in an array and the sums of all the subarray which you calculated are of no use. Now as a challenge your friend has given you a new array and given one value to you. He/she then asked you to calculate the number of subarrays whose sum is equal to the given value. If you are able to calculate the required number, he will return you the original array.
Constraints
1<=T<=1000
1<=N<=2*10^5
1<=K<=10^9
1<=a[i]<=10^9
Input Format
T ( Test case)
N (Size of the array) K (Target)
A[N]={a[0],a[1]....., a[N-1]}
Output Format
For each test case print the number in new line.
Example 1
Input:
1
5 7
2 4 1 2 7
Output:
3
Explanation:
Subarrays {2,4,1}, {4,1,2}, {7} having their sum as 7 which is given target. So the answer will be 3 because there are 3 different subarrays whose sum is equal to a given target
Log In to solve the Question