func_code_string: #include <bits/stdc++.h>   using namespace std;   int nf, ne, ns, rf, re, rs, df, de;   double disf, dise, diss;   int num[22];   double f[22][22][22];   double ans;   double valf[22], vale[22];   inline double cover(double l1, double r1, double l2, double r2) {     return max(0.0, min(r1, r2) - max(l1, l2));   }   void calc(int n) {     double ss = sqrt(1.0 * rs * rs - 1.0);     double ff = sqrt(1.0 * rf * rf - 1.0);     double ee = sqrt(1.0 * re * re - 1.0);     memset(valf, 0, sizeof(valf));     memset(vale, 0, sizeof(vale));     for (int i = (0); i < (int)(n); ++i) {       if (num[i] == 2) continue;       valf[i] = (ff + ff) * 1.0 * df;       if (ff && ss) {         for (int j = i; j >= 0; j--) {           if (ss + ff < i - j) break;           if (!num[j]) continue;           valf[i] +=               cover(1.0 * i - ff, 1.0 * i + ff, 1.0 * j - ss, 1.0 * j + ss) *               1.0 * df * num[j];         }         for (int j = i + 1; j < n; j++) {           if (ss + ff < j - i) break;           if (!num[j]) continue;           valf[i] +=               cover(1.0 * i - ff, 1.0 * i + ff, 1.0 * j - ss, 1.0 * j + ss) *               1.0 * df * num[j];         }       }       vale[i] = (ee + ee) * 1.0 * de;       if (ee && ss) {         for (int j = i; j >= 0; j--) {           if (ss + ee < i - j) break;           if (!num[j]) continue;           vale[i] +=               cover(1.0 * i - ee, 1.0 * i + ee, 1.0 * j - ss, 1.0 * j + ss) *               1.0 * de * num[j];         }         for (int j = i + 1; j < n; j++) {           if (ss + ee < j - i) break;           if (!num[j]) continue;           vale[i] +=               cover(1.0 * i - ee, 1.0 * i + ee, 1.0 * j - ss, 1.0 * j + ss) *               1.0 * de * num[j];         }       }     }   }   void dp(int n) {     memset(f, 0.0, sizeof(f));     int presum = 0;     for (int i = (0); i < (int)(n); ++i) {       presum += num[i];       if (!i) {         f[i][nf][ne] = 0;         if (num[i] <= 1) {           if (nf) f[i][nf - 1][ne] = valf[i];           if (ne) f[i][nf][ne - 1] = vale[i];         }         if (num[i] == 0) {           if (nf > 1) f[i][nf - 2][ne] = valf[i] * 2;           if (ne > 1) f[i][nf][ne - 2] = vale[i] * 2;           if (nf && ne) f[i][nf - 1][ne - 1] = valf[i] + vale[i];         }         continue;       }       for (int j = nf; nf - j <= (i * 2 - presum + num[i]) && j >= 0; j--) {         for (int k = ne; ne - k + nf - j <= (i * 2 - presum + num[i]) && k >= 0;              k--) {           f[i][j][k] = max(f[i][j][k], f[i - 1][j][k]);           if (num[i] <= 1) {             if (j) f[i][j - 1][k] = max(f[i][j - 1][k], f[i - 1][j][k] + valf[i]);             if (k) f[i][j][k - 1] = max(f[i][j][k - 1], f[i - 1][j][k] + vale[i]);           }           if (num[i] == 0) {             if (j > 1)               f[i][j - 2][k] = max(f[i][j - 2][k], f[i - 1][j][k] + valf[i] * 2);             if (k > 1)               f[i][j][k - 2] = max(f[i][j][k - 2], f[i - 1][j][k] + vale[i] * 2);             if (j && k)               f[i][j - 1][k - 1] =                   max(f[i][j - 1][k - 1], f[i - 1][j][k] + valf[i] + vale[i]);           }         }       }     }     ans = max(ans, f[n - 1][0][0]);   }   void dfs(int pos, int lft) {     if (lft < 0) return;     if (pos * 2 >= (nf + ne + ns)) {       if (lft == 0) {         calc(pos);         dp(pos);       }       return;     }     num[pos] = 0;     dfs(pos + 1, lft);     num[pos] = 1;     dfs(pos + 1, lft - 1);     num[pos] = 2;     dfs(pos + 1, lft - 2);     num[pos] = 0;   }   int main() {     scanf( %d%d%d%d%d%d%d%d , &nf, &ne, &ns, &rf, &re, &rs, &df, &de);     dfs(0, ns);     printf( %.8lf n , ans);     return 0;   }   