#K71832. Maximum Average Speed
Maximum Average Speed
Maximum Average Speed
You are given speed logs for n days and an integer k. Your task is to compute the maximum average speed over any consecutive k days. The answer should be rounded to two decimal places.
The average for a segment of days is computed as follows:
\(\text{average} = \frac{\sum_{i=1}^{k}{s_i}}{k}\)
where \(s_i\) is the speed on day \(i\). Use a sliding window technique to efficiently compute this value.
inputFormat
The input is read from standard input (stdin) and consists of two lines.
- The first line contains two integers \(n\) and \(k\) separated by a space, where \(n\) is the total number of days and \(k\) is the number of consecutive days to consider.
- The second line contains \(n\) space-separated integers representing the speeds for each day.
outputFormat
Output the maximum average speed, rounded to two decimal places, on a single line to standard output (stdout).
## sample7 3
1 12 5 2 8 7 10
8.33