func_code_string: #include <bits/stdc++.h>   using namespace std;   long long dp[55][55][55][55];   long long ara[55];   double f[55];   long long cnt(long long i, long long k, long long sum, long long zawad) {     if (i == 0) return (k == 0 && sum == 0);     if (k > i || sum < 0) return 0;     if (dp[i][k][sum][zawad] != -1) return dp[i][k][sum][zawad];     dp[i][k][sum][zawad] = cnt(i - 1, k, sum, zawad);     if (i != zawad)       dp[i][k][sum][zawad] += cnt(i - 1, k - 1, sum - ara[i], zawad);     return dp[i][k][sum][zawad];   }   int main() {     long long n, i, j, k, p, q, x, y;     cin >> n;     long long s = 0;     for (i = 1; i <= n; i++) {       cin >> ara[i];       s += ara[i];     }     cin >> p;     if (s <= p) {       printf( %lld n , n);       return 0;     }     f[1] = 1.0 / n;     for (i = 2; i <= n; i++) f[i] = f[i - 1] * (i - 1) / (n - i + 1.0);     memset(dp, -1, sizeof(dp));     double ans = 0;     for (i = 1; i <= n; i++) {       for (j = 1; j <= n; j++) {         for (k = p - ara[i] + 1; k <= p; k++) {           q = cnt(n, j - 1, k, i);           ans += q * (j - 1) * f[j];         }       }     }     printf( %.10lf n , ans);     return 0;   }   