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 INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N, M;
	cin >> N >> M;
	vector<double> a(N);
	vector<double> sum(N+1, 0);
	REP(i, N)
		cin >> a[i];
	REP(i, N){
		sum[i+1] = sum[i]+a[i];
	}
	vector<vector<vector<long double>>> dp(2, vector<vector<long double>>(510, vector<long double>(510, -INF_LL)));
	dp[0][0][0] = 0;
	REP(i, N){
		dp[1] = vector<vector<long double>>(510, vector<long double>(510, -INF_LL));
		REP(j, M+1){
			REP(k, i+1){
				chmax(dp[1][j][k], dp[0][j][k]);
				chmax(dp[1][j+1][i+1], dp[0][j][k]+(sum[i+1]-sum[k])/(i-k+1));
			}
		}
		swap(dp[0], dp[1]);
	}
	cout << fixed << setprecision(10) << dp[0][M][N] << endl;
}