Ellipse Eclipse

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

요약
타원의 두 초점과 장축의 길이가 주어질 때, 타원을 감싸는 가장 작은 축 정렬 경계 상자의 좌표를 출력한다.
난이도

보통10점 중 4점

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

문제

An Ellipse is a 2D geometric figure. It consists of the set of all points such that the sum of the distance from each point to two specific points is constant. The two specific points are called the Foci of the ellipse. The Major Axis of an ellipse is the diameter of the ellipse that runs through both foci. It is the longest diameter of the ellipse.

Given an ellipse’s two foci and the length of its major axis, determine the coordinates of the tightest axis-aligned bounding box that can block out that ellipse.

입력

The single line of input contains five integers x_1x\_1, y_1y\_1, x_2x\_2, y_2y\_2 (−100≤x_1,y_1,x_2,y_2≤100-100≤x\_1,y\_1,x\_2,y\_2≤100) and aa ((x_2−x_1)2+(y_2−y_1)2≤a≤1,000\sqrt{(x\_2 - x\_1)^2 + (y\_2 - y\_1)^2} ≤ a ≤ 1\\,000), where the two foci of the ellipse are at (x_1,y_1)(x\_1,y\_1) and (x_2,y_2)(x\_2,y\_2) and the length of the major axis is aa (Note that’s the major axis, not the semi-major axis or the major radius).

출력

Output four space-separated real numbers on a single line. The numbers, in order, are x_lowx\_{\text{low}}, y_lowy\_{\text{low}}, x_highx\_{\text{high}}, y_highy\_{\text{high}}, where (x_low,y_low)(x\_{\text{low}},y\_{\text{low}}) is the lower left corner of the tightest bounding box of the ellipse, and (x_high,y_high)(x\_{\text{high}},y\_{\text{high}}) is the upper right corner of the tightest bounding box of the ellipse. Each output will be considered correct if it is within an absolute or relative error of 10−410^{-4}.

예제2

  1. 예제 1

    입력
    -5 0 5 0 16
    
    예상 출력
    -8.000000 -6.244998 8.000000 6.244998
    
  2. 예제 2

    입력
    51 23 19 67 70
    
    예상 출력
    7.778685 13.871235 62.221315 76.128765