当前位置: 移动技术网 > IT编程>开发语言>C/C++ > HDU2080 夹角有多大2

HDU2080 夹角有多大2

2019年06月03日  | 移动技术网IT编程  | 我要评论

富康大包围,职场常用英语,公益海报设计欣赏

2019-05-17

15:00:09

加油加油,fightting !!!

这道题不知道acos()函数,acos()返回的是弧度,转化成度数要 / pi * 180

也没有想到通过向量 

但是想到了余弦定理

这道题与改革春分有一点点的联系,向量

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define pi 3.1415926
int main()
{
    int t;
    int i,j;
    scanf("%d", &t);
    for(i = 0; i < t; i++)
    {
        double x1, y1, x2, y2;
        scanf ("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        double a, b, c;
        a = x1 * x2 + y1 * y2;
        b = sqrt(x1 * x1 + y1 * y1) * sqrt(x2 * x2 + y2 * y2);
        c = acos(a / b) / pi * 180;
        printf("%.2lf\n", c);
    }
    return 0;
} 

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网