#C3377. Minimum Bushes Pruning
Minimum Bushes Pruning
Minimum Bushes Pruning
You are given several test cases. In each test case, there are N bushes with various heights and a target height T. Your task is to determine the minimum number of bushes that need to be pruned so that all bushes have a height at most T. A bush needs pruning only if its height is strictly greater than the target height.
The problem can be formulated using the following mathematical expression:
[ \text{result} = \sum_{i=1}^{N} \mathbf{1}_{{h_i > T}} ]
where \(h_i\) is the height of the \(i\)th bush, and \(\mathbf{1}_{\{h_i > T\}}\) is the indicator function that is 1 if \(h_i > T\) and 0 otherwise.
You need to process multiple test cases. For each test case, output the number of bushes that need to be pruned.
inputFormat
The first line of input contains a single integer T representing the number of test cases.
Each test case is described as follows:
- The first line contains two integers N and T — the number of bushes and the target height, respectively.
- The second line contains N space-separated integers representing the heights of the bushes.
Input is read from stdin
.
outputFormat
For each test case, output a single line containing one integer — the minimum number of bushes that need to be pruned so that no bush exceeds the target height.
Output should be written to stdout
.
2
3 15
18 13 20
5 10
5 15 10 20 5
2
2
</p>