#K41022. Average Distance on Running Days
Average Distance on Running Days
Average Distance on Running Days
Rahul runs every day and records the distance he covers. Given a minimum distance threshold \(M\) (in kilometers), your task is to compute the average distance he ran on those days when his run was at least \(M\) kilometers. If he never runs at least \(M\) kilometers on any day, the average should be reported as 0.00.
The formula to compute the average is given by:
\(\text{Average} = \frac{\sum_{i=1}^{n} d_i}{n}\)
where \(d_i\) are the distances that are at least \(M\) and \(n\) is the count of days meeting that condition. The result must be rounded to two decimal places.
inputFormat
The input starts with an integer \(T\) representing the number of test cases. Each test case consists of two lines:
- The first line contains a single integer \(M\) (the minimum distance threshold).
- The second line contains 7 space-separated integers representing the distances (in kilometers) Rahul ran each day.
outputFormat
For each test case, output a single line containing the average distance on days when the distance was at least \(M\) kilometers. The average must be rounded to two decimal places.
## sample3
5
10 5 3 6 8 2 7
8
4 9 12 5 10 3 8
101
100 100 100 100 100 100 100
7.20
9.75
0.00
</p>