State Fair

시간 제한1초메모리 제한1024 MB

요약
반지름 r인 원과 가장 짧은 변의 길이가 c인 이등변삼각형이 주어질 때, 원을 포함하면서 같은 두 긴 변의 최소 길이를 구한다.
난이도

보통10점 중 7점

유형
기하, 수학, 이분 탐색, 완전 탐색
정답자
아직 제출이 없습니다

문제

"Kooky Kenny" (as the carnies call him) is setting up a park attraction at the state fair.

He has already set up the tent for the circus performance he wishes to put up. What he wants to know is how to construct the barrier around the tent.

He knows he wants an isoceles triangle, with the shorter side being the side where he'll set up the ticket booth. Therefore people will be deterred from going along the longer sides, since park patrons hate walking.

While he knows how long he wants to make the shorter side, he wants to use the minimum amount of tape to make the other edges.

Putting on a circus is a costly business! Expenses need to be minimized and profits need to be maximized! Therefore the shorter side will be just long enough to encompass the circus tent.

Being the park's problem solver, can you help figure out the other side lengths for Kenny? Assuming the tent is a perfect circle of course.

입력

You will be given the number of test cases. 1 < tc ≤ 100

For each test case you will be given the radius of the circus tent r and the length of the shortest side c of the attraction. The radius will be bounded by c, 1 ≤ r < c/2 ≤ 100. Note: r and c are both integers.

출력

Your program should echo out the minimum length of the other side that still encompasses the circus tent and satisfies the triangle. Round your answer to 3 digits. Separate separate cases with a new line.

예제1

  1. 예제 1

    입력
    2
    2 5
    1 5
    
    예상 출력
    11.389
    3.452