#C3274. Total Weight Below Threshold
Total Weight Below Threshold
Total Weight Below Threshold
You are given multiple delivery test cases. For each test case, you are provided with the number of deliveries, an array of delivery weights, and a weight threshold. Your task is to compute the total weight of all deliveries that are strictly less than the threshold.
More formally, for each test case, given an integer \(N\), an array \(W = [w_1, w_2, \dots, w_N]\), and an integer \(K\), compute:
[ \text{total} = \sum_{i=1}^{N} ; [w_i < K] \cdot w_i ]
where \([w_i < K]\) is 1 if \(w_i < K\) and 0 otherwise. Print the result for each test case on a separate line.
inputFormat
The input begins with an integer \(T\) denoting the number of test cases. For each test case:
- An integer \(N\) representing the number of deliveries.
- A line with \(N\) space-separated integers representing the weights of deliveries.
- An integer \(K\) representing the weight threshold.
All values are provided via standard input.
outputFormat
For each test case, output a single line with one integer: the sum of weights for which the weight is strictly less than \(K\).
## sample2
5
50 75 100 120 30
100
4
10 20 30 25
25
155
30
</p>