Preparing NOJ


1000ms 65536K


There are different methods of transporting people fromplace to place: cars, bikes, boats, trains, planes, etc.For very long distances, people generally fly in a plane.But this has the disadvantage that the plane must flyaround the curved surface of the earth. A distancetravelled would be shorter if the traveller followed astraight line from one point to the other through atunnel through the earth.For example, travelling from Waterloo to Cairo requires adistance of 9293521 metres following the great circle route around the earth, butonly 8491188 metres following the straight line through the earth.For this problem, assume that the earth is a perfect sphere with radius of6371009 metres.


The first line of input contains a single integer, the number of test cases tofollow. Each test case is one line containing four floating point numbers: thelatitude and longitude of the origin of the trip, followed by the latitude andlongitude of the destination of the trip. All of these measurements are indegrees. Positive numbers indicate North latitude and East longitude, whilenegative numbers indicate South latitude and West longitude.


For each test case, output a line containing a single integer, the difference inthe distance between the two points following the great circle route around thesurface of the earth and following the straight line through the earth, inmetres. Round the difference of the distances to the nearest integer number ofmetres.

Sample Input:

43.466667 -80.516667 30.058056 31.228889

Sample Output:




本题由旧版NOJ导入,来源:Waterloo local contest



Provider NOJ

Code NOJ1516


Submitted 1

Passed 1

AC Rate 100%

Date 04/20/2019 10:03:10


Nothing Yet