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:
#define ll long long
#define pb push_back
#include<bits/stdc++.h>
using namespace std;
const int N = 200000;
int arr[N];
double dp[600][600];
vector<int> v;
int n, x, m;
void solve(){
	cin >> n >> m;
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++) dp[i][j] = 0.0;
	}
	double pre[n + 1];
	for(int i = 0; i <= n; i++) pre[i] = 0.0;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		pre[i + 1] = pre[i] + 1.0 * arr[i];
	}
	for(int i = 1; i <= n; i++){
		dp[i][1] = (pre[i] - pre[0]) / i;
	}
	for(int i = 1; i <= n; i++){
		for(int j = 2; j <= m; j++){
			if(j > i) continue;
			dp[i][j] = dp[i][j - 1];
			for(int k = 1; k <= i; k++){
				double sss = 1.0 * (pre[i] - pre[k - 1]) / (1.0 * i - k + 1.0);
				if(k - 1 < j - 1 ) continue;
				double val = sss + dp[k - 1][j - 1];
				if(dp[i][j] <= val) dp[i][j] = val;
			//	cout << i << " -> " << j << " " << k << " " << val << endl;
			}
		}
	}
	printf("%.6lf\n", dp[n][m]);
}
//001095004368
int main(void){
	solve();
	return 0;
}