Problem: problem

AOR Ika got a water tank with a size of $ 1 $ in length and $ N $ in width. The aquarium is tall enough to hold water. The aquarium has $ N-1 $ partitions and is evenly spaced into $ N $ compartments. When water was poured here, the height of the water in each section became $ a_i $.

AOR Ika decided to remove some dividers and reduce the number of compartments to $ M $ or less. When you have removed the dividers, find the maximum sum of the water heights in each compartment.

The thickness of the partition can be ignored.



input

$ N \ M $
$ a_1 \ cdots a_N $

output

Output the maximum value of the total water height of each section in one line. Also, output a line break at the end. It is acceptable if the relative or absolute error is less than or equal to $ 10 ^ {-6} $.

Example

Input

5 3
9 1 2 3 9


Output

20.000000

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const double INF=1e20;

double dp[555][555];

signed main(){
    int N,M;
    cin>>N>>M;

    vint A(N);rep(i,N)cin>>A[i];

    fill_n(*dp,555*555,-INF);
    dp[0][0]=0;

    rep(i,N){
        rep(j,M){
            int sum=0;
            chmax(dp[i][j+1],dp[i][j]);
            for(int k=1;i+k<=N;k++){
                sum+=A[i+k-1];
                chmax(dp[i+k][j+1],dp[i][j]+1.0*sum/k);
            }
        }
    }

    printf("%.20f\n",dp[N][M]);
    return 0;
}