Prosjek
의견: 0
\(7^{th}\) round, March \(7^{th}\) 2015
You are given an array of \(N\) integers. Find a consecutive subsequence of numbers of the length at least
\(K\) that has the maximal possible average.
Please note: the average of a subsequence is the sum of all the numbers in the subsequence divided
by its length.
In test cases worth 30% of total points, it will hold that \(N\) is not larger than 5 000.
The first line of input contains two integers \(N\) (1 ⩽\(N\) ⩽\(3 \cdot 10^{5}\)) and \(K\) (1 ⩽\(K\) ⩽\(N\)). The second
line of input contains \(N\) integers \(a_{i}\) (1 ⩽\(a_{i}\) ⩽\(10^{6}\)).
The first and only line of output must contain the maximal possible average. An absolute deviation
of ±0.001 from the official solution is permitted.
4 1
1 2 3 4
4 2
2 4 3 4
6 3
7 1 2 1 3 6output
output
4.000000
3.666666
3.333333평가 및 의견
Prosjek
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Prosjek