Tanky WooRSS

HDOJ 2080 夹角有多大II

06 Aug 2010
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2080


注意对反三角函数的运用

代码:

#include
#include
#include
const double pi=3.1415926;
using namespace std;
int main()
{
    int c;
    double x1,y1,x2,y2,a;
    cin>>c;
    while(c--)
    {
        cin>>x1>>y1>>x2>>y2;
        a=(x1*x2*1.0+y1*y2*1.0)/(sqrt(x1*1.0*x1+y1*y1)*sqrt(x2*x2*1.0+y2*y2));
        printf("%.2lf\n",acos(a)*180/pi);
    }
    return 0;
}