What is the angle of HDU2080 II?

Source: Internet
Author: User

What is the angle of HDU2080 II?

How large 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 xhd is that there are two points in a plane, and the angle between the two points and the source point is calculated respectively.

Note: The angle ranges from 0,180 to. The two points do not appear at the center of the center.

The first line of Input data is a data T, indicating that T groups of data exist.
Each data set has four real numbers x1, y1, x2, and y2, respectively representing the coordinates of two points. The range of these real numbers is [-].

For each group of input data, the Output angle is precise to 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-2 abcosy;

#include 
 
  #include 
  
   #include 
   
    const double PI = acos(-1.0);int main() {// freopen("stdin.txt", "r", stdin);double 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);printf("%.2lf\n", acos((a + b - c) / (2 * sqrt(a * b))) * 180.0 / PI);}return 0;}
   
  
 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.