#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<queue>
#include<bitset>
#include<vector>
#include<iomanip>
#include<algorithm>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI>VVVI;
typedef long long LL;
const int maxn = 211111;
int sum[maxn];
bool slope_cmp(int i,int j,int k)
{
return (sum[i]-sum[j])*(i-k)>(sum[i]-sum[k])*(i-j);
}
int main() {
ios::sync_with_stdio(false);
int i,N,F,j;
int ans=0;
scanf("%d%d",&N,&F);
for(i=1;i<=N;++i) scanf("%d",&j),sum[i]=sum[i-1]+j;
front=rear=0;
for(i=j=0;i<=N-F;++i)
{
if(slope_cmp(i+F,i,j))
j=i;
ans=max(ans,1000*(sum[i+F]-sum[j])/(i+F-j));
}
printf("%d\n",ans);
return 0;
}
poj 2018
最新推荐文章于 2020-09-14 17:33:23 发布