n,k = map(int,input().split())
a = list(map(int,input().split()))
result = 0
for i in range(n):
s = sum(a[i : i + k])
l = k
result = max(result, s / l)
for j in range(i + k, min(n, i + 2 * k)):
s += a[j]
l += 1
result = max(result, s / l)
print(result)
#include <iostream>
#include <vector>
#include<iomanip>
using namespace std;
int main() {
int n,x,k;
cin>>n;
cin>>k;
vector<int> a;
vector<int> pre;
a.push_back(0);
pre.push_back(0);
for(int i = 0;i < n;i++){
cin>>x;
a.push_back(x);
}
for(int i = 1;i <= n;i++){
pre.push_back(a[i]+pre[i-1]);
}
double max = 0;
double sum=0;
long double average;
for(double i = k;i <= n;i++){
for(int j = 1;j <= n;j++){
if(j+i-1 > n) break;
sum = pre[j+i-1] - pre[j-1];
average = sum/i;
if(average > max) max = average;
}
}
cout<<setprecision(10);
cout<<max<<endl;
return 0;
}
337A - Puzzles | 495A - Digital Counter |
796A - Buying A House | 67A - Partial Teacher |
116A - Tram | 1472B - Fair Division |
1281C - Cut and Paste | 141A - Amusing Joke |
112A - Petya and Strings | 677A - Vanya and Fence |
1621A - Stable Arrangement of Rooks | 472A - Design Tutorial Learn from Math |
1368A - C+= | 450A - Jzzhu and Children |
546A - Soldier and Bananas | 32B - Borze |
1651B - Prove Him Wrong | 381A - Sereja and Dima |
41A - Translation | 1559A - Mocha and Math |
832A - Sasha and Sticks | 292B - Network Topology |
1339A - Filling Diamonds | 910A - The Way to Home |
617A - Elephant | 48A - Rock-paper-scissors |
294A - Shaass and Oskols | 1213A - Chips Moving |
490A - Team Olympiad | 233A - Perfect Permutation |