#include<stdio.h>
#include<string.h>
#define inf 999999999
#define N 151000
int a[N],c[N];
int main() {
int n,k,i,j,min,p,t;
while(scanf("%d%d",&n,&k)!=EOF) {
min=inf;
memset(c,0,sizeof(c));
for(i=1;i<=n;i++) {
scanf("%d",&a[i]);
c[i]=a[i]+c[i-1];
if(i>=k) {
p=i-k+1;
t=c[i]-c[p-1];
if(min>t) {
min=t;
j=p;
}
}
}
printf("%d\n",j);
}
return 0;
}
转载于:https://www.cnblogs.com/thefirstfeeling/p/4410906.html