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>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

double dp[510][510];
double sum[510];

double c(int L,int R) { // [L,R]
  assert( L <= R );
  double ret = sum[R];
  if( L-1 >= 0 ) ret -= sum[L-1];
  //cout << L << "," << R << " ret = " << ret << " L " << sum[L] << " " << sum[R] << endl;
  return ret;
}

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) {
    cin >> a[i];
    sum[i] += a[i];
    if( i-1 >= 0 ) sum[i] += sum[i-1];
  }
  rep(i,n+1) rep(j,m+1) dp[i][j] = -1;
  dp[0][0] = 0;
  double maxi = 0;
  rep(cur,n) {
    rep(i,m+1) {
      if( LT(dp[cur][i],0) ) continue;
      REP(nex,cur,n) {
	int coef = 1;
	dp[nex+1][i+coef] = max(dp[nex+1][i+coef],dp[cur][i]+c(cur,nex)/(double)(nex-cur+1));
      }
    }
  }
  rep(j,m+1) 
    if( j <= m ) {
      maxi = max(maxi,dp[n][j]);
    }
  printf("%.10f\n",maxi);
  compute();
  return 0;
}