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 <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int n;
int m;
vector<ld> a(505,0);

ld dp[505][505];

ld sum[505];

int main(){
    cin >> n >> m;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }
    for(int i = 0;i < 505;i++){
        for(int j = 0;j < 505;j++){
            dp[i][j] = -1e9;
        }
    }

    dp[0][0] = 0;
    rep(i,1,n){
        rep(j,1,m){
            rep(from,0,i - 1){
                dp[i][j] = max(dp[i][j] , dp[from][j - 1] + (sum[i] - sum[from])/(i - from));
            }
        }
    }
    cout << fixed << setprecision(8);

    cout << dp[n][m] << endl;


}