QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 64 MB 満点: 140

#16396. PROSJEK

統計

给你一个长度为 $N$ 的整数数组。请找出一个长度至少为 $K$ 的连续子序列,使得该子序列中元素的平均值最大。

请注意:子序列的平均值是指该子序列中所有数字的和除以其长度。

输入格式

输入的第一行包含两个整数 $N$ ($1 \le N \le 3 \cdot 10^5$) 和 $K$ ($1 \le K \le N$)。

第二行包含 $N$ 个整数 $a_i$ ($1 \le a_i \le 10^6$)。

输出格式

输出的第一行也是唯一一行必须包含最大可能的平均值。允许与官方答案的绝对误差在 $\pm0.001$ 以内。

子任务

在占总分 30% 的测试数据中,满足 $N$ 不大于 $5\,000$。

样例

输入样例 1

4 1
1 2 3 4

输出样例 1

4.000000

输入样例 2

4 2
2 4 3 4

输出样例 2

3.666666

输入样例 3

6 3
7 1 2 1 3 6

输出样例 3

3.333333

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.