410471: GYM104024 C Array Brush

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Array Brushtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Given an array, it's easy to calculate its maximum value $$$A$$$ and minimum value $$$B$$$. We then define variation range $$$V$$$ of an array as $$$V = A - B$$$. Now zyw has an integer array $$$a_1, a_2, ... , a_n$$$ and an array brush with length $$$k$$$. The array brush can convert exact $$$k$$$ consecutive numbers in the array into their average. Zyw only has one chance to use the array brush and he wants to minimize the variation range of the array. Can you tell him the minimum variation range?

Input

There are two lines in the input.

The first line contains two integers $$$n, k\ (1 \leq n \leq 10^5, 1 \leq k \leq n)$$$, represents the length of the array and the array brush.

The second line contains $$$n$$$ integers $$$a_1, a_2, ... , a_n\ (-10^5 \leq a_i \leq 10^5)$$$, represents the original array.

Output

Output one real number $$$V$$$, represents the minimum variation range zyw can get. Your answer should have an absolute or relative error of at most $$$10^{-4}$$$.

ExamplesInput
5 3
2 3 1 4 5
Output
1.333333
Input
5 2
2 3 1 4 5
Output
3.000000
Note

In the first sample, zyw performs array brush on $$$[1, 4, 5]$$$ and the array becomes $$$[2, 3, 3.3333, 3.3333, 3.3333]$$$, the variation range is $$$1.3333$$$.

加入题单

上一题 下一题 算法标签: