Logo
(追記) (追記ここまで)

24957번 - Loop of Chocolate 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB17514911695.868%

문제

Let’s make sweets of a fancy shape that is a loop of chocolate.

Figure A.1. A loop of chocolate formed by a union of six spheres

The shape of a loop is formed by a union of a number of spheres of the same size, where every sphere intersects with exactly two others.

(a) Union of four spheres (b) Four intersections of the four spheres in (a)
Figure A.2. A loop of chocolate formed by a union of four spheres

Your job is to write a program that, for given the size and the positions of spheres, computes the total volume of the union of the spheres, i.e., the amount of chocolate required for filling the loop formed by the union.

[Hints] Two spheres of the same radius $r$ intersect each other when the distance between their centers, $d,ドル is less than 2ドルr$. The volume of the intersection is known to be $$\frac{2}{3}\pi (r - d/2)^2(2r+d/2)\text{.}$$

The volume of the sphere of radius $r$ is 4ドル\pi r^3/3$.

입력

The input consists of a single test case of the following format.

$\begin{align*}&n ,円 r \\ & x_1 ,円 y_1 ,円 z_1 \\ & \vdots \\ & x_n ,円 y_n ,円 z_n \end{align*}$

$n$ and $r$ are integers. $n$ is the number of spheres (4ドル ≤ n ≤ 100$). All the spheres has the same radius $r$ (2ドル ≤ r ≤ 100$). $(x_k, y_k, z_k)$ indicates the coordinates of the center of the $k$-th sphere ($k = 1, \dots , n$). All of $x_k,ドル $y_k,ドル and $z_k$ are integers between $-100$ and 100ドル,ドル inclusive.

The $k$-th and the $k + 1$-th spheres intersect each other for 1ドル ≤ k < n$. The 1ドル$-th and the $n$-th spheres also intersect. No other pairs of spheres intersect.

출력

Output in a line the volume of the union of the spheres. Relative error of the output should be within 10ドル^{-7}$.

제한

예제 입력 1

6 9
20 0 10
20 10 0
10 20 0
0 20 10
0 10 20
10 0 20

예제 출력 1

17149.528141

예제 입력 2

4 12
10 10 0
10 -10 0
-10 -10 0
-10 10 0

예제 출력 2

27813.56696

예제 입력 3

6 9
23 3 13
20 10 0
10 20 0
3 23 13
0 10 20
10 0 20

예제 출력 3

17470.837758

예제 입력 4

4 2
0 0 0
3 0 0
3 3 0
0 3 0

예제 출력 4

122.52211349

예제 입력 5

8 70
100 100 0
0 100 0
-100 100 0
-100 0 0
-100 -100 0
0 -100 0
100 -100 0
100 0 0

예제 출력 5

10220648.1

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > ICPC 2021 Asia Yokohama Regional A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /