#include #include #include #include #include const double pi = acos(-1.0); int main() { int n, L0; scanf("%d%d", &n, &L0); std::vector L(n + 1); std::vector> prefix(n + 1), suffix(n + 1); for (int i = 0; i <= n; ++i) { scanf("%d", &L[i]); } prefix[0] = {L[0], L[0]}; for (int i = 1; i <= n; ++i) { prefix[i].first = prefix[i - 1].first + L[i]; prefix[i].second = std::max(prefix[i - 1].second, L[i]); } suffix[n] = {L[n], L[n]}; for (int i = n - 1; i >= 0; --i) { suffix[i].first = suffix[i + 1].first + L[i]; suffix[i].second = std::max(suffix[i + 1].second, L[i]); } auto area = [&L0] (double r1, double r2) { if (r1 + r2 <= L0) return 0.0; if (L0 + r2 <= r1) return r2 * r2 * pi; if (L0 + r1 <= r2) return r1 * r1 * pi; double t1 = acos((r1 * r1 + L0 * L0 - r2 * r2) / (2 * r1 * L0)) * 2; double t2 = acos((r2 * r2 + L0 * L0 - r1 * r1) / (2 * r2 * L0)) * 2; double res = 0; res += 0.5 * r1 * r1 * (t1 - sin(t1)); res += 0.5 * r2 * r2 * (t2 - sin(t2)); return res; }; for (int i = 1; i <= n; ++i) { double R1 = prefix[i - 1].first; double r1 = std::max(2 * prefix[i - 1].second - R1, 0.); double R2 = suffix[i].first; double r2 = std::max(2 * suffix[i].second - R2, 0.); printf("%.10f\n", area(R1, R2) - area(R1, r2) - area(r1, R2) + area(r1, r2)); } return 0; }