func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   void sync_stdio() {     cin.tie(NULL);     ios_base::sync_with_stdio(false);   }   struct Sync_stdio {     Sync_stdio() {       cin.tie(NULL);       ios_base::sync_with_stdio(false);     }   } _sync_stdio;   vector<int> v;   vector<double> pref;   vector<double> inv;   vector<double> sum;   double get(int x, int y) {     return sum[y] - sum[x - 1] - (inv[y] - inv[x - 1]) * pref[x - 1];   }   vector<vector<double>> dp;   const double EPS = 1e-7;   void solve(int i, int l, int r, int optl, int optr) {     int mid = (l + r) / 2;     int optm = 0;     for (int j = (optl); j < (optr + 1); ++j) {       if (dp[i][mid] + EPS > dp[i - 1][j] + get(j + 1, mid)) {         dp[i][mid] = dp[i - 1][j] + get(j + 1, mid);         optm = j;       }     }     if (l <= mid - 1) {       solve(i, l, mid - 1, optl, optm);     }     if (mid + 1 <= r) {       solve(i, mid + 1, r, optm, optr);     }   }   int main() {     int n, k;     cin >> n >> k;     v.resize(n);     for (int __i = 0; __i < (n); ++__i) cin >> v[__i];     ;     pref.resize(n + 1);     inv.resize(n + 1);     sum.resize(n + 1);     for (int i = (1); i < (n + 1); ++i) {       pref[i] = pref[i - 1] + v[i - 1];       inv[i] = inv[i - 1] + 1.0 / v[i - 1];       sum[i] = sum[i - 1] + pref[i] / v[i - 1];     }     dp.assign(k + 1, vector<double>(n + 1, 1e18));     vector<vector<long long>> prev(k + 1, vector<long long>(n + 1, -1));     dp[0][0] = 0;     cout << fixed << setprecision(10);     for (int i = (1); i < (k + 1); ++i) {       solve(i, 1, n, 0, n);     }     cout << dp[k][n];     return 0;   }   