Chef and Subarray
All submissions for this problem are available.Chef wants to attend an event, but outside the event there is one security guard. If chef wants to attend that event, chef needs to solve the given problem by security guard. Security guard gave one array and $2$ numbers $L$ and $R$. Chef have to find the number of sub arrays which has sum of elements lying in the range of given two number($L$ and $R$) including both numbers. Chef needs your help so chef can attend event quickly. ###Input - First line of the input contains a single integer $T$ denotes the number of test cases. Description of test case is given below - First line contains $3$ integers $N$, $L$ and $R$. ($N$ denoting the number of array elements) - Second line contains $N$ space-separated integers. ###Output For each test case, Print a single line containing one integer that denotes sub-arrays having sum in the range $L$ to $R$. ###Constraints - $1<=T<=1000$ - $1<=L,R<=10^8$ - $L < R$ - $1<=N<=10^5$ - $1<=Ai<=10^8$ Example Input 2 3 3 8 1 4 6 4 4 13 2 3 5 8 Example output 3 6 ###Explanation Example Case 1: The sub arrays are (1,4),(4),(6). Example Case 2: The sub arrays are (2,3),(2,3,5),(3,5),(5),(5,8),(8).
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.