当前位置: 代码迷 >> 综合 >> Codeforces #494 C.Intense Heat
  详细解决方案

Codeforces #494 C.Intense Heat

热度:26   发布时间:2024-01-11 10:49:06.0
  1. C. Intense Heat
  2. 废话不多说,直接上AC程序!
  3. #include<bits/stdc++.h>
    using namespace std;
    double dp[5005][5005];
    double ans = 0;
    int main(){int n,tk;cin >> n>>tk;for (int i=1;i<=n;i++){cin >> dp[i][1];}for (int i=1;i<=n;i++){for (int k = 1;i-k>=-1;k++){dp[i][k] = dp[i - 1][k - 1]  + dp[i][1];if(k>=tk && ((double)dp[i][k]/k)>ans)ans = (double)dp[i][k]/k;}}cout <<setprecision(10)<<ans;
    }
    巧不巧,double能过。