#P1404. 平均数

平均数

平均数

  • 时间限制:1 秒
  • 内存限制:512 MiB

题目描述

给一个长度为 nn 的数列,我们需要找出该数列的一个子串,使得子串平均数最大化,并且子串长度 ≥m\ge m。

English translation

Statement

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

输入格式

第一行两个整数 nn 和 mm。

接下来 nn 行,每行一个整数 aia_i,表示序列第 ii 个数字。

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.

输出格式

一个整数,表示最大平均数的 10001000 倍,如果末尾有小数,直接舍去,不要用四舍五入求整。

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

样例输入 1

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

样例输出 1

6500

数据范围

  • 对于 60%60\% 的数据,保证 m≤n≤104m\le n\le 10^4;

  • 对于 100%100\% 的数据,保证 1≤m≤n≤1051 \leq m\le n\le 10^5,0≤ai≤20000\le a_i\le2000。

  • 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。