can you help me?↵
↵
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.↵
INPUT The first line of input contains two integers N (1 6 N 63 · 105) and K (16 K 6 N). The second line of input contains N integers ai (16 ai 6106).↵
OUTPUT↵
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.↵
SCORING↵
In test cases worth 30% of total points, it will hold that N is not larger than 5000.↵
SAMPLE TESTS↵
input input input↵
↵
4 1 1 2 3 4 4 2 2 4 3 4 6 3↵
input↵
6 3 ↵
7 1 2 1 3 6↵
↵
output output output↵
4.000000 3.666666 output↵
3.333333↵
↵
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.↵
INPUT The first line of input contains two integers N (1 6 N 63 · 105) and K (16 K 6 N). The second line of input contains N integers ai (16 ai 6106).↵
OUTPUT↵
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.↵
SCORING↵
In test cases worth 30% of total points, it will hold that N is not larger than 5000.↵
SAMPLE TESTS↵
↵
4 1 1 2 3 4 4 2 2 4 3 4 6 3
input↵
6 3 ↵
7 1 2 1 3 6↵
output output output↵
4.000000 3.666666
3.333333↵