1009. 范围统计
|
Description
Given a list of N numbers and Q queries,for each query given two numbers a,b.You are asked to count how many numbers in the list that are in the range [a,b].
Input
Input contains multiple testcases.
The first line of input is an Integer T(T <= 10), the number of testcase.
The second line is an integer N(N <= 100000),the number in the list.
Then N integers followed.
The next line is an integer Q(Q <= 10000),the number of query.
For each query there are two interger a,b(a <= b) -- the lower bound and the upper bound accordingly
Output
For each query ,output one integer that represent how many numbers are in the range [a,b] .
Sample Input
1 10 5 2 4 1 3 9 7 6 8 10 5 4 6 2 7 0 5 -100 100 -100 0
Sample Output
3 6 5 10 0 Problem Source: 潘汉涛 |