1 条题解
-
0
#include <bits/stdc++.h> #define int long long using namespace std; double a[105],s[105]; signed main(){ int n,m; cin >> n >> m; for(int i=1;i<=n;i++){ cin >> a[i]; s[i]=s[i-1]+a[i]; } double maxn=0; for(int i=1;i<=n-m+1;i++){ maxn=max(maxn,(s[i+m-1]-s[i-1])/m); } cout << fixed << setprecision(2) << maxn; return 0; }
- 1
信息
- ID
- 4748
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 2
- 标签
- 递交数
- 20
- 已通过
- 16
- 上传者