COCI 2015

Revision en2, by ken_love_rin, 2015-09-08 19:21:07

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
  6 3 
  7 1 2 1 3 6
  output
  3.333333

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ken_love_rin 2015-09-08 19:21:07 91
en1 English ken_love_rin 2015-09-08 19:19:55 861 Initial revision (published)