14742 - Calculate the distance between two points
|
Time |
Memory |
Case 1 |
1 sec |
32 MB |
Case 2 |
1 sec |
32 MB |
Case 3 |
1 sec |
32 MB |
Case 4 |
1 sec |
32 MB |
Case 5 |
1 sec |
32 MB |
Description
Write a program to calculate the distance between two points, where the points are represented in polar coordinates as (r1, θ1) and (r2, θ2).
The input consists of one line containing r1, θ1, r2, and θ2.
The output is the distance between the two points. Note that we need to use the sin and cos functions, so we must include math.h. When compiling with gcc, remember to add -lm to link the math library.
Input
Two points expressed in polar coordinates.
Ex. 10 0.0 10 3.1415926
Output
The distance between the two points.
Ex.20.000000