#C11371. Calculate Average in Range

    ID: 40680 Type: Default 1000ms 256MiB

Calculate Average in Range

Calculate Average in Range

Given the lower bound \(L\) and the upper bound \(U\), and a list of floating point measurements, calculate the average of the measurements that lie within the range \([L, U]\) (inclusive). The result should be formatted to six decimal places. If no measurement exists within the range, output "No measurements in range".

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains two space-separated floating-point numbers, (L) and (U), representing the lower and upper bounds respectively.
  2. The second line contains an integer (N), which is the number of measurements.
  3. Each of the following (N) lines contains a single floating-point number representing a measurement.

outputFormat

If there is at least one measurement within the inclusive range ([L, U]), print the average of these measurements formatted to six decimal places. Otherwise, print the string "No measurements in range" on standard output (stdout).## sample

10.5 20.75
5
8.25
15.0
22.1
18.5
10.5
14.666667