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

22801번 - Move the Object 스페셜 저지다국어

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

문제

Mike and his friends are crazy for a video game. The aim of the game is to move a circular object placed on a two-dimensional field to the destination point by an analog pad. On the field there are some polygonal obstacles through which the object cannot move. When the object gets to the destination point, the player gains the score depending on the distance it moved over, and then advances to the next stage. As you might realize, the shorter move makes the higher score.

Though many obstacles appear in the latter stages, only one obstacle is set in each of first several stages, and Mike is absorbed in moving the object by the shortest distance in those stages. In fact, he moves the object by shorter distance than any his friends, but he is not sure that he really moves by the minimum distance. So he calls you for the help.

Your task is to write a program that computes the minimum moving distance for given data.

입력

The input consists of a series of data sets.

The first line of each set contains an integer N (3 ≤ N ≤ 20) indicating the number of vertices of the polygonal obstacle. The next N lines specify coordinates of the vertices, which are given counterclockwise. Each line consists of two real numbers that indicates x and y-coordinates of a vertex respectively. Then a line containing four numbers SX, SY, DX and DY follows, where (SX, SY) and (DX, DY) are coordinates of the starting and destination points respectively.

Each coordinate value is an integer between −100 and 100 inclusive. The radius of the circular object is one. No obstacle is degenerate. The position of the object is represented by the coordinate of its center. The starting point and the destination point do not coincide.

The input is terminated by N = 0.

출력

For each data set, output a line containing the minimum distance needed to move the object from the starting point to the destination point, with four decimal digits and an error not greater than 0.0001.

It is guaranteed that there is a way to move the object from the starting point to the destination point.

제한

예제 입력 1

4
-5 -5
5 -5
5 5
-5 5
0 -10 0 10
8
10 20
-10 20
-20 10
-20 -10
-10 -20
10 -20
20 -10
20 10
-21 0 21 0
5
0 10
-5 5
-5 0
0 5
5 0
10 0 16 8
0

예제 출력 1

25.8546
71.4259
10.0000

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Winter Camp > JAG Winter Camp 2005 Practice Contest H번

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

출처

대학교 대회

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

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