当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4319:Subsequence Problem

Special Judge 特殊评判
题目描述
You must be very familiar with the classic maximum subsequence problem:

Given an integer sequence A1, A2, ..., An, Find a continuous subsequence A[i..j] with maximum sum: Ai + Ai+1 + ... + Aj. (1 <= i <= j <= n)

As a talented ACMer, you can solve this problem in seconds. So here comes a harder version:

Given an integer sequence A1, A2, ..., An, Find a continuous subsequence A[i..j] with maximum average value: (Ai + Ai+1 + ... + Aj) / (j - i + 1). (1 <= i <= j <= n)

As a talented ACMer, you can solve this problem in minutes. So here comes a more harder version:

Given an integer sequence A1, A2, ..., An, Find a continuous subsequence A[i..j] with maximum squared average value: (Ai + Ai+1 + ... + Aj)^2 / (j - i + 1). (1 <= i <= j <= n)

As a talented ACMer, can you solve this problem?
输入解释
The first line of each test case contains one integer n (1 <= n <= 100,000), the length of the original sequence. The next line contains n integers A1, A2, ..., An. (-1,000 <= Ai <= 1,000)
输出解释
Output one real number for each test case, indicating the max squared average value described above. You will get accepted if the difference between your answer and standard answer is no more than 10-4.
输入样例
3
1 5 4
3
3 5 4
输出样例
40.500000
48.000000
来自杭电HDUOJ的附加信息
Author TJU
Recommend zhuyuanchen520

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4319

最后修改于 2020-10-25T23:12:23+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 32768/32768K(Java/Others)