P7795 [COCI 2014/2015 #7] PROSJEK
Description
Given a sequence $a$ of $n$ integers, find a contiguous subsequence of length at least $k$ such that the average value of all numbers in this subsequence is as large as possible.
Input Format
The input has $2$ lines.
The first line contains two integers $n, k$.
The second line contains $n$ integers $a_1, a_2, \dots, a_n$, representing all elements of the sequence $a$.
Output Format
Output one line containing a real number, representing the maximum average value among all contiguous subsequences with length at least $k$.
For each test point, your program will pass if the relative error between your output and the standard answer does not exceed $10^{-3}$.
Explanation/Hint
**Constraints**
For $30\%$ of the testdata, $n \leqslant 5000$.
For all testdata, $1 \leqslant k \leqslant n \leqslant 3 \times 10^5$, and $1 \leqslant a_i \leqslant 10^6$.
**Source**
This problem comes from **_[COCI 2014-2015](https://hsin.hr/coci/archive/2014_2015/) [CONTEST 7](https://hsin.hr/coci/archive/2014_2015/contest7_tasks.pdf) T5 PROSJEK_**. With the original testdata configuration, the full score is $140$ points.
Translated and organized by [Eason_AC](https://www.luogu.com.cn/user/112917).
Translated by ChatGPT 5