How big is the angle of HDU2080 II

Source: Internet
Author: User
Tags acos

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

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.