#P1404. 平均数

平均数

Problem Description

Given a sequence of length nn, find a contiguous subarray whose average is maximized, with the subarray length ≥m\ge m.

Input Format

The first line contains two integers nn and mm.
The next nn lines each contain an integer aia_i, representing the ii-th number of the sequence.

Output Format

Output a single integer: 10001000 times the maximum average. If there is a fractional part, truncate it directly; do not round.

10 6
6
4
2
10
3
8
5
9
4
1

6500

Hint

Constraints

  • For 60%60\% of the testdata, it is guaranteed that m≤n≤104m\le n\le 10^4。
  • For 100%100\% of the testdata, it is guaranteed that 1≤m≤n≤1051 \leq m\le n\le 10^5, 0≤ai≤20000\le a_i\le2000。

Translated by ChatGPT 5