#abc341g. G - Highest Ratio
G - Highest Ratio
Score: points
问题描述
你已知一个长度为 的序列 。对于每个 ,解决以下问题:
- 找出当选择满足 的整数 时,序列 中从第 项到第 项可能的最大平均值。
- 在这里,序列 中从第 项到第 项的平均值定义为 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length .
For each , solve the following problem:
- Find the maximum possible average value of the -th to -th terms of the sequence when choosing an integer such that .
Here, the average value of the -th to -th term of the sequence is defined as .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain the answer to the problem for .
Your output will be considered correct if, for every line, the absolute or relative error of the printed value from the true value is at most .
Sample Input 1
5
1 1 4 5 3
Sample Output 1
2.80000000
3.33333333
4.50000000
5.00000000
3.00000000
For , the possible choices for are , and the average value for each of them is:
Thus, the maximum is achieved when , and the answer for is .
Similarly, for , the maximum is achieved when , respectively, with the values of , , , .
Sample Input 2
3
999999 1 1000000
Sample Output 2
999999.00000000
500000.50000000
1000000.00000000
update @ 2024/3/10 01:35:37