Wrong Answer.wrong answer 1st numbers differ - expected: '2.6666667', found: '2.6666700', error = '-954814315449365809755573372893417771167360221575307160875939130429176003595274749967502602240573627124450811917706981933360209630863910666452110583791616.0000000‘
代码:
#include<iostream>
#include<cstdio>
using namespace std;
int p[5005];
int main(){
int n,k,x;
double maxx=0;
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>x;
p[i]=p[i-1]+x;
}
for(int i=k;i<=n;i++)
for(int j=i;j<=n;j++)
maxx=max((p[i]-p[i-k-1])*1.0/i,maxx);
cout<<maxx;
return 0;
}