func_code_string: #include <bits/stdc++.h>   using namespace std;   struct point {     double x, y;     point(double x = 0, double y = 0) : x(x), y(y) {}     point operator-(const point &b) const { return point(x - b.x, y - b.y); }     double operator*(const point &b) const { return x * b.y - y * b.x; }   };   point p[200050];   int a[200050], q[200050];   double sum[200050], t[200050], E[200050], dp[55][200050];   bool check(int i, int j, double v) {     return p[j].y - p[i].y <= (p[i].x - p[j].x) * v;   }   int main() {     int n, k;     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; ++i) scanf( %d , &a[i]);     for (int i = 1; i <= n; ++i) {       sum[i] = sum[i - 1] + a[i];       t[i] = t[i - 1] + 1.0 / a[i];       E[i] = E[i - 1] + sum[i] / a[i];     }     for (int i = 1; i <= n; ++i) dp[1][i] = E[i];     for (int x = 2; x <= k; ++x) {       int head = 0, tail = 0;       q[tail++] = 0;       for (int i = 1; i <= n; ++i) {         if (i < x) {           p[i] = point(-sum[i], sum[i] * t[i] - E[i] + dp[x - 1][i]);           while (head + 1 < tail &&                  (p[q[tail - 1]] - p[q[tail - 2]]) * (p[i] - p[q[tail - 2]]) >= 0)             tail--;           q[tail++] = i;         }         while (head + 1 < tail && check(q[head], q[head + 1], t[i])) head++;         int j = q[head];         dp[x][i] = p[j].x * t[i] + p[j].y + E[i];         p[i] = point(-sum[i], sum[i] * t[i] - E[i] + dp[x - 1][i]);         while (head + 1 < tail &&                (p[q[tail - 1]] - p[q[tail - 2]]) * (p[i] - p[q[tail - 2]]) >= 0)           tail--;         q[tail++] = i;       }     }     printf( %.9f n , dp[k][n]);     return 0;   }   