Maximum mean - MarisaOJ: Marisa Online Judge

Maximum mean

Time limit: 1000 ms
Memory limit: 256 MB
You are given an array $A$ of $n$ integers. Find a subarray of length at least $k$ with the maximum mean. ### Input - The first line contains 2 integers $n, k$. - The second line contains $n$ integers $A_i$. ### Output - Print the largest mean of all subarrays of length at least $k$. Your answer will be considered correct if its absolute or relative error does not exceed $10^{-3}$. In other words, your answer, $x$, will be compared to the correct answer, $y$. If $|x-y| < 10^{-3}$, then your answer will be considered correct. ### Constraints - $1 \le k \le n \le 10^5$. - $1 \le A_i \le 10^9$ ### Example Input: ``` 5 3 1 2 3 4 5 ``` Output: ``` 4.000 ```