#include #include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; template vector> vec2d(int n, int m, T v){ return vector>(n, vector(m, v)); } template vector>> vec3d(int n, int m, int k, T v){ return vector>>(n, vector>(m, vector(k, v))); } template void print_vector(vector v, char delimiter=' '){ if(v.empty()) { cout << endl; return; } for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter; cout << v.back() << endl; } template class Cumsum{ public: Cumsum(vector v): v(v){ n = v.size(); v_cumsum = vector(n+1, T(0)); for(int i = 0; i < n; i++) v_cumsum[i+1] = v_cumsum[i]+v[i]; } /** * v[l] + ... + v[r-1] */ T sum(int l, int r){ if(r <= l) return T(0); if(r > n) r = n; if(l < 0) l = 0; return v_cumsum[r]-v_cumsum[l]; } private: int n; vector v; vector v_cumsum; }; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int n; cin >> n; double len; cin >> len; vector l(n+1); for(int i = 0; i < n+1; i++) cin >> l[i]; auto cumsum = Cumsum(l); auto common_area = [&](double l, double r){ if(l+r <= len) return 0.0; if(l >= len+r) return r*r*M_PI; if(r >= len+l) return l*l*M_PI; double a = acos((len*len+l*l-r*r)/(2*len*l)); double b = acos((len*len+r*r-l*l)/(2*len*r)); double area = l*l*sin(2*a)/2 + r*r*sin(2*b)/2; // cout << l << ' ' << r << ':' << l*l*a << ' ' << r*r*b << ' ' << area << ' ' << a << ' ' << b << ' ' << l*l*a + r*r*b - area << endl; return l*l*a + r*r*b - area; }; // print_vector(l); for(int c = 1; c <= n; c++){ // if(c == 1 || c == n){ // cout << 0 << endl; // continue; // } double l0 = l[0], r0 = l.back(); double l1 = cumsum.sum(1, c); double r1 = cumsum.sum(c, n); double l_small = max(l0-l1, 0.0); double l_large = l0+l1; double r_small = max(r0-r1, 0.0); double r_large = r0+r1; // cout << l_small << ' ' << l_large << ' ' << r_small << ' ' << r_large << endl; double ans = common_area(l_large, r_large) - common_area(l_small, r_large) - common_area(l_large, r_small) + common_area(l_small, r_small); cout << ans << endl; } }