#P1419. 寻找段落
寻找段落
Description
Given a sequence of length , where is the value of the -th element. You need to find the most valuable "segment" in the sequence. A segment is a contiguous subsequence whose length is in . The most valuable segment is the one with the maximum average value.
The average value of a segment equals the total value of the segment divided by the segment length.
Input Format
The first line contains an integer , the length of the sequence.
The second line contains two integers and , the allowed range of the segment length, i.e., in .
From the 3rd line to line , each line contains one integer, the value of each element.
Output Format
Output a real number with decimal places, representing the average value of the optimal segment.
3
2 2
3
-1
2
1.000
Hint
Constraints
- For of the testdata, .
- For of the testdata, , , .
Source
- Adapted by tinylic.
Translated by ChatGPT 5
京公网安备 11011102002149号