func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 5100;   int n, T;   int pr[MAXN], t[MAXN];   double rest[MAXN];   double dp[MAXN][MAXN];   double pw[MAXN];   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> T;     for (int i = 1; i <= n; ++i) {       cin >> pr[i] >> t[i];       double mult = (100. - pr[i]) / 100.;       rest[i] = 1.;       for (int k = 1; k < t[i]; ++k) {         rest[i] *= mult;         if (rest[i] < 1e-15) {           rest[i] = 0.;         }       }     }     dp[0][0] = 1.;     for (int i = 1; i <= n; ++i) {       if (t[i] == 1) {         for (int j = 1; j <= T; ++j) {           dp[i][j] = dp[i - 1][j - 1];         }       } else {         double p = pr[i] / 100., q = 1 - p;         double cur_val = 0.;         double last_prob = p;         {           double tmp = q;           int pw = t[i] - 2;           while (pw) {             if (pw & 1) {               last_prob *= tmp;             }             pw /= 2;             tmp *= tmp;           }           if (last_prob < 1e-15) {             last_prob = 0.;           }         }         for (int j = 1, r = 0; j <= T; ++j) {           if (j > r + (t[i] - 1)) {             cur_val -= dp[i - 1][r] * last_prob;             ++r;           }           cur_val *= q;           cur_val += p * dp[i - 1][j - 1];           dp[i][j] = cur_val;           if (j >= t[i]) {             dp[i][j] += rest[i] * dp[i - 1][j - t[i]];           }           if (dp[i][j] < 1e-15) {             dp[i][j] = 0.;           }         }       }     }     double res = 0.;     for (int i = 1; i < n; ++i) {       pw[1] = 1;       double q = (100. - pr[i + 1]) / 100.;       for (int j = 2; j <= t[i + 1]; ++j) {         pw[j] = pw[j - 1] * q;         if (pw[j] < 1e-15) {           pw[j] = 0.;         }       }       for (int j = t[i + 1] + 1; j <= T; ++j) {         pw[j] = 0.;       }       for (int j = 1; j <= T; ++j) {         res += i * dp[i][j] * pw[T + 1 - j];       }     }     for (int j = 1; j <= T; ++j) {       res += n * dp[n][j];     }     cout << fixed << setprecision(10);     cout << res <<   n ;     return 0;   }   