Segment Tree
题号:NC13892
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 128 M,其他语言256 M
64bit IO Format: %lld

题目描述

Today HH is learning a new data structure  named segment tree, which is often used to solve segment problem, here comes one:
Gave you an unordered sequence of length n,(a1,a2,…,an), now you are supposed to calculate how many segment [L,R](1≤L≤R) are there satisfies two conditions :
1.the length of the segment is k(i.e. R−L+1=k).
2.the number between L and R(both including) appears at least q times in total. 
HH thinks the problem is too easy so he gives the problem to you.

输入描述:

The first line contains an positive integer T(1≤T≤10), represents there are T test cases. 
For each test case: The first line contains three positive integers n,k,q(1≤n≤100,1≤k≤100,1≤q≤100),the length of the sequence , the length of the segment [l,R], and the times required to appear. The second line contains n integers a1,a2…an(1≤ai≤100) - the sequence.

输出描述:

For each test case, output one line an integer : the number of segment satisfies both conditions.
示例1

输入

复制
3
5 3 2
2 3 2 4 5
5 3 3
2 3 2 4 5
5 3 6
2 3 2 4 5

输出

复制
4
3
0

说明

In the first example , we can find 4 segments:
[1,3],1 appears 0 time,2 appears 2 times,3 appears 1 time,so 3 times in total.
[2,4],4 times in total.[3,5] 3 times in total.[4,6],2 times in total.
In the second example, we can find:
[1,3],[2,4],[3,5].
In the third example, we can't find any.