How big is the Angle IITime limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total Submission (s): 7676 Accepted Submission (s): 3858
Problem description The problem with this XHD is this: In a plane there are two points, the size of the angle between the two points, respectively, and the origin of the connection.
Note: The range of the angle [0,180], the two points will not appear in the center.
The first line of input data is a data T, which indicates that there is a T group of data.
Each set of data has four real x1,y1,x2,y2 that represent the coordinates of the two points, and the range of these real numbers is [ -10000,10000].
Output for each set of input data, the angle of the outputs is exactly the size of the two digits after the decimal point.
Sample Input
21 1 2 21 1 1 0
Sample Output
0.0045.00
Cosine formula: c^2 = a^2 + b^2-2abcosy;
#include <stdio.h> #include <string.h> #include <math.h>const double PI = ACOs ( -1.0); int main () {// Freopen ("Stdin.txt", "R", stdin);d ouble x1, y1, x2, Y2, A, B, C, Y;int t;scanf ("%d", &t), while (t--) {scanf ("%lf%lf%lf %lf ", &x1, &y1, &x2, &y2); a = x1 * x1 + y1 * y1;b = x2 * x2 + y2 * y2;c = (x1-x2) * (X1-X2) + (y1-y2 ) * (y1-y2);p rintf ("%.2lf\n", ACOs ((A + b-c)/(2 * sqrt (A * b))) * 180.0/pi);} return 0;}
How big is the angle of HDU2080 II