Problem F
Prosjek
You are given an array of $N$ integers. Find a consecutive subsequence of numbers of the length at least $K$ that has the maximal possible average.
Input
The first line of input contains two integers $N$ ($1 \leq N \leq 3 \cdot 10^5$) and $K$ ($1 \leq K \leq N$). The second line of input contains $N$ integers $a_ i$ ($1 \leq a_ i \leq 10^6$).
Output
The first and only line of output must contain the maximal possible average. An absolute deviation of $\pm 0.001$ from the official solution is permitted.
Sample Input 1 | Sample Output 1 |
---|---|
4 1 1 2 3 4 |
4.000000 |
Sample Input 2 | Sample Output 2 |
---|---|
4 2 2 4 3 4 |
3.666666 |
Sample Input 3 | Sample Output 3 |
---|---|
6 3 7 1 2 1 3 6 |
3.333333 |