func_code_string: #include <bits/stdc++.h>   using namespace std;   int forbidInd;   int A[100000 + 10];   long long int memo[60][60][60];   long long int solve(int i, int k, int x) {     if (k < 0 || x < 0) return 0;     if (i == 0) {       if (x == 0 && k == 0) return 1;       if (k == 1 && x == A[i] && forbidInd != 0)         return 1;       else         return 0;     }     if (memo[i][k][x] != -1) return memo[i][k][x];     long long int ret = 0;     ret = solve(i - 1, k, x);     if (i != forbidInd) ret += solve(i - 1, k - 1, x - A[i]);     return memo[i][k][x] = ret;   }   long long int C[60][60];   int main() {     for (int i = 0; i < 51; i++)       for (int j = 0; j < 51; j++)         if (i == j || j == 0)           C[i][j] = 1;         else           C[i][j] = C[i - 1][j] + C[i - 1][j - 1];     int n, P, x;     while (cin >> n) {       int sum = 0;       for (int i = 0; i < n; i++) {         cin >> A[i];         sum += A[i];       }       cin >> P;       double ans = 0;       for (int k = 0; k < n; k++) {         forbidInd = k;         memset(memo, -1, sizeof memo);         for (int s = 1; s <= n - 1; s++)           for (int x = P - A[k] + 1; x <= P; x++) {             long long int ret = solve(n - 1, s, x);             long long int tmp = C[n][s] * (n - s);             ans = ans + ((ret * s * 1.) / (tmp * 1.0));           }       }       if (sum <= P) ans = n * 1.;       printf( %.10lf n , ans);     }     return 0;   }   