#include #include #define FORR(i,b,e) for(int i=(b);i<(int)(e);++i) #define FOR(i,e) FORR(i,0,e) #define dump(var) cerr << #var ": " << var << "\n" #define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n" typedef long long ll; typedef unsigned long long ull; using namespace std; int L[100010], K[100010]; double len[100]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, Q, lmax = 0; double lsum = 0; cin >> N; FOR(i, N) { cin >> L[i]; lsum += L[i]; lmax = max(lmax, L[i]); } cin >> Q; FOR(i, Q) { cin >> K[i]; } len[0] = (double)lmax; FORR(k, 1, 52) { int kk = k*10000; double l = 0, u = len[k-1], m, d; FOR(i, 10) { m = (l+u)/2; d = 1 / m; ll cnt = 0; FOR(j, N) { cnt += (ll)(L[j]*d); } if (cnt < kk) { u = m; } else { l = m; } } len[k] = m; } cout << fixed << setprecision(10); FOR(q, Q) { double l = len[K[q]/10000+1], u = len[K[q]/10000], m, d; FOR(i, 30) { // (u-l < EPS) m = (l+u)/2; d = 1 / m; ll cnt = 0; FOR(j, N) { cnt += (ll)(L[j]*d); } if (cnt < K[q]) { u = m; } else { l = m; } } cout << m << "\n"; } return 0; }