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

22819번 - Enclosing Circles 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB177281822.500%

문제

A number of circles are given. A circle may be disjoint from other circles, overlapping with some other circles, or even totally surrounding or surrounded by another circle.

Figure 1. given circles

Figure 2. rope layout

We want to enclose all these circles by a rope. Of course, the length of the rope should be minimized. For example, given circles of Figure 1, the rope should run as shown in Figure 2.

Your job is to write a program which finds the rope layout, and computes the minimum length of the rope. The thickness of the rope is negligible.

입력

The input consists of multiple data sets. Each data set is given in the following format.

n
x1 y1 r1
x2 y2 r2
...
xn yn rn

The first line of a data set contains an integer n, which is the number of circles. n is positive, and does not exceed 100.

The following n lines are descriptions of circles. Three values in a line are x-coordinate and y-coordinate of the center, and radius (called r in the rest of the problem) of the circle, in this order. Each value is given by a decimal fraction, with 3 digits after the decimal point. Values are separated by a space character.

Each of x, y and r is never less than 0.01, and is never greater than 100.0. Two circles are never the same. Speaking more precisely, at least one of x, y or r of two circles has a difference larger than 0.01.

The end of the input is indicated by a line containing a zero.

출력

For each data set, the minimum length of the rope should be printed, each in a separate line. The printed values should have 5 digits after the decimal point. They may not have an error greater than 0.00001.

제한

예제 입력 1

1
10.000 10.000 10.000
4
10.000 10.000 5.000
30.000 10.000 5.000
30.000 30.000 5.000
10.000 30.000 5.000
6
10.000 20.000 10.000
20.000 50.000 5.000
30.000 40.000 2.000
1.000 2.000 3.000
10.000 20.000 20.000
20.000 40.000 1.500
0

예제 출력 1

62.83185
111.41593
153.16052

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > Japan Domestic Contest > 2002 Japan Domestic Contest E번

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

출처

대학교 대회

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

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