아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Circle

면접 대비

시간 제한3초메모리 제한512 MB

요약
원 밖의 두 점 A와 B에 대해, 원 위의 점 C를 골라 두 경로가 원 밖을 지나도록 하면서 A에서 C까지와 B에서 C까지 거리의 합을 최소로 만든다.
난이도

보통10점 중 6점

유형
기하, 수학, 그리디, 구현
정답자
아직 제출이 없습니다

문제

There are two points AA and BB and an obstacle circle OO on a Cartesian plane.

Now, you need to choose a point CC on the boundary of OO and then move both points AA and BB to point CC. While moving, the path of either point AA or BB can only go outside circle OO or touch its boundary.

Your goal is to minimize the total moving distance, that is, the sum of the moving distances of AA and BB.

입력

The first line contains a single integer t (1≤t≤105)t\ (1 \le t \le 10^5), the number of test cases.

Each test case is given on a single line and contains seven integers x_1,y_1,x_2,y_2,x_3,y_3,rx\_1, y\_1, x\_2, y\_2, x\_3, y\_3, r, where −103≤x_1,y_1,x_2,y_2,x_3,y_3≤103-10^3 \le x\_1, y\_1, x\_2, y\_2, x\_3, y\_3 \le 10^3 and 1≤r≤1031 \le r \le 10^3. Here, A=(x_1,y_1)A = (x\_1, y\_1), B=(x_2,y_2)B = (x\_2, y\_2), and OO is a circle centered at (x_3,y_3)(x\_3, y\_3) with radius rr. It is guaranteed that neither AA nor BB is strictly inside OO.

출력

For each test case, output a single line with a single real number: the answer rounded to the third decimal place. It is guaranteed that the fourth decimal place is neither 44 nor 55.

예제1

  1. 예제 1

    입력
    3
    0 0 2 2 1 1 1
    0 0 2 2 1 0 1
    0 0 2 2 1 -1 1
    
    예상 출력
    3.571
    2.927
    3.116