4335 - 기하: 대권거리

Time Limit: 1s Memory Limit: 128MB

Submissions: 711 Solved: 525
Description

대권거리(great circle distance)는 지구표면에서 두 점 사이의 거리를 의미합니다. (x1, y1)과 (x2, y2)를 위도(latitude)와 경도(longitude)로 구성된 두 지점이라고 할때, 두 지점 사이의 대권거리는 다음 공식을 통해서 계산할 수 있습니다. 

The great circle distance is the distance between two points on the surface of a sphere. Let (x1, y1) and (x2, y2) be the geographical latitude and longitude of two points. The great circle distance between the two points can be computed using the following formula: 

여러분은 위도와 경도로 구성된 두 지점을 입력으로 받아 대권거리를 계산하는 프로그램을 작성해야 합니다. 평균 지구 반경 radius 는 6,371.01 km 이고, 여러분은 degrees를 radians으로 변환하기 위해 Java에서 제공하는 Math.toRadians 를 활용해야 할 수 있습니다. 위 식에서 사용된 위도와 경도는 북서를 기준으로 하기 때문에 음수가 나온다면 남동쪽을 의미합니다.

Write a program that prompts the user to enter the latitude and longitude of two points on the earth in degrees and displays its great circle distance. The average earth radius is 6,371.01 km. Note that you need to convert the degrees into radians using the Math.toRadians method since the Java trigonometric methods use radians. The latitude and longitude degrees in the formula are for north and west. Use negative to indicate south and east degrees.

Input

* Line 1 : x1 y1 

* Line 2 : x2 y2 

 

Output

* Line 1 : 두점 사이의 거리를 km단위로 출력 (소수점 둘째자리로 반올림)

 

Sample Input
39.55 -116.25
41.5 87.37
Sample Output
10691.79
Source

JAVA2015 PE4.2