#include #include #include #include #include #include #include #include #include #include #include #include #include #pragma region using namespace std; #define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++) #define rep(i,n) FOR(i,0LL,n) #define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--) #define rrep(i,n) RFOR(i,0LL,n) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x) #define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end()) #define pb push_back #define endl '\n' typedef long long int ll; typedef vector vll; typedef vector vvll; typedef pair pll; typedef vector vpll; typedef vector vs; typedef map MAP; const ll inf = 2222222222222222222LL; const ll mod = 1000000007LL; ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf; string s; bool ok; ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 }; #pragma endregion #define MAX 222222 typedef long double d; ll a[1111], lsum[1111], rsum[1111], lma[1111], rma[1111]; pair cross(ll r1, ll r2) { pair p(0, 0); p.first = (m + ((d)r1*r1 - r2 * r2) / m) / 2; p.second = sqrt(r1 * r1 - p.first*p.first); return p; } d area(ll r1,ll r2) { d ret = 0; if (r1 + r2 <= m) return ret; if (llabs(r1 - r2) >= m) { ret = min(r1, r2)*min(r1, r2)*acos(-1); return ret; } pair p = cross(r1, r2); d dist = sqrt(p.first*p.first + p.second*p.second); d rad = acos(1 - (2 * p.second*p.second / dist / dist)); ret = (rad *r1*r1 - dist * dist* sin(rad)) / 2; dist = sqrt((m - p.first) *(m - p.first) + p.second*p.second); rad = acos(1 - (2 * p.second*p.second / dist / dist)); ret += (rad *r2*r2 - dist * dist* sin(rad)) / 2; return ret; } int main(void) { ios::sync_with_stdio(false); cin.tie(0); cout.precision(6); cin >> n; cin >> m; FOR(i, 0, n + 1) cin >> a[i]; FOR(i, 1, n + 1) lsum[i] = lsum[i - 1] + a[i - 1]; FOR(i, 1, n + 1) lma[i] = max(lma[i - 1], a[i - 1]); RFOR(i, 1, n + 1) rsum[i] = rsum[i + 1] + a[i]; RFOR(i, 1, n + 1) rma[i] = max(rma[i + 1], a[i]); FOR(i, 1, n + 1) { d ans = area(lsum[i], rsum[i]); if (lsum[i] - lma[i] < lma[i]) ans -= area(lma[i]*2 - lsum[i],rsum[i]); if (rsum[i] - rma[i] < rma[i]) ans -= area(lsum[i], rma[i]*2 - rsum[i]); if (lsum[i] - lma[i] < lma[i] && rsum[i] - rma[i] < rma[i]) ans += area(lma[i]*2 - lsum[i], rma[i]*2 - rsum[i]); cout << fixed << ans << endl; } return 0; }