luogu#P1404. 平均数

    ID: 396 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>数学贪心二分福建省历届夏令营分数规划

平均数

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 mn104m\le n\le 10^4
  • For 100%100\% of the testdata, it is guaranteed that 1mn1051 \leq m\le n\le 10^5, 0ai20000\le a_i\le2000

Translated by ChatGPT 5