#pragma GCC optimize ("O2") #pragma GCC target ("avx2") #include using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_back #define mp make_pair #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define Would #define you #define please int N; int A[10]; double dp[1024][410][2]; double keisan(int i, int s, int t) { if (dp[i][s][t] >= 0) return dp[i][s][t]; if (i == 0) { if (s > 200) dp[i][s][t] = 1; else dp[i][s][t] = 0; return dp[i][s][t]; } if (t) { double ret = 1; rep(x, N) if (i >> x & 1) { double tmp = keisan(i - (1 << x), s - A[x], 0) / A[x] + keisan(i, s, 0) * (1 - 1.0 / A[x]); chmin(ret, tmp); } return dp[i][s][t] = ret; } double ret = 0; rep(x, N) if (i >> x & 1) { double ret2 = 1; rep(y, N) if (i >> y & 1) { double p1 = 1.0 / A[x]; double p2 = 1.0 / A[y]; double tmp1 = p1 / (p1 + (1 - p1) * p2) * keisan(i - (1 << x), s + A[x], 1); double tmp2 = (1 - p1) * p2 / (p1 + (1 - p1) * p2) * keisan(i - (1 << y), s - A[y], 0); chmin(ret2, tmp1 + tmp2); } chmax(ret, ret2); } return dp[i][s][t] = ret; } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N; rep(i, N) cin >> A[i]; rep(i, 1 << N) rep(j, 401) rep(k, 2) dp[i][j][k] = -1; double kotae = keisan((1 << N) - 1, 200, 0); cout << setprecision(12) << kotae << endl; Would you please return 0; }