func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 201001;   const int MAXK = 51;   const double inf = 1e100;   const double eps = 1e-10;   int K, N;   int tab[MAXN];   long long sum[MAXN];   double res[MAXN];   double odw[MAXN];   double dp[MAXK][MAXN];   struct Pt {     double x, y;   };   int ccw(const Pt& a, const Pt& b, const Pt& c) {     double w = 0;     w += a.x * (b.y - c.y);     w += b.x * (c.y - a.y);     w += c.x * (a.y - b.y);     return w < -eps ? -1 : w > eps;   }   int main() {     scanf( %d %d , &N, &K);     for (int i = (1); i <= (N); ++i) {       scanf( %d , &tab[i]);       sum[i] = sum[i - 1] + tab[i];       odw[i] = odw[i - 1] + 1. / tab[i];       res[i] = res[i - 1] + (double)sum[i] / tab[i];     }     for (int i = (1); i <= (N); ++i) dp[1][i] = res[i];     for (int k = (2); k <= (K); ++k) {       vector<Pt> v;       for (int i = (k - 1); i <= (N); ++i) {         Pt pt = {-1. * sum[i], dp[k - 1][i] - res[i] + sum[i] * odw[i]};         while (v.size() >= 2 && ccw(v[((int)((v).size())) - 2], v.back(), pt) > 0)           v.pop_back();         v.push_back(pt);       }       int p = 0;       for (int i = (k); i <= (N); ++i) {         while (p + 1 < ((int)((v).size())) &&                v[p].x * odw[i] + v[p].y > v[p + 1].x * odw[i] + v[p + 1].y)           ++p;         dp[k][i] = v[p].x * odw[i] + v[p].y + res[i];       }     }     printf( %.10lf n , dp[K][N]);   }   