///给由n(n<=10^5)个数组成的正整数序列,求其长度>=k的子序列的平均值的最大值。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn=100002; const double INF=9999999999.0; int q[maxn],a[maxn],sum[maxn],n,k; double ans; double getDP(int i,int j) { return 1.0*(sum[i]-sum[j])/(i-j); } int input() { char ch=' '; while(ch<'0'||ch>'9')ch=getchar(); int x=0; while(ch<='9'&&ch>='0')x=x*10+ch-'0',ch=getchar(); return x; } int main() { //freopen("//media/学习/ACM/input.txt","r",stdin); while(~scanf("%d%d",&n,&k)) { int i,j,l=0,r=-1; for(sum[0]=0,ans=0.0,i=1;i<=n;i++) sum[i]=sum[i-1]+input(); for(i=0;i+k<=n;i++) { while(l<r&&getDP(i,q[r])<=getDP(q[r],q[r-1]))r--; q[++r]=i; while(l<r&&getDP(i+k,q[l])<=getDP(i+k,q[l+1]))l++; if(ans<getDP(i+k,q[l]))ans=getDP(i+k,q[l]); } printf("%.2lf\n",ans); } return 0; }