码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 1714 math

时间:2015-07-22 20:14:21      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<cmath>
#include<stdio.h>
using namespace std;

int main()
{
    double a, b, x, y;
    int n;
    scanf("%d", &n);
    while (n--)
    {
        scanf("%lf%lf%lf%lf", &a, &b, &x, &y);
         if (y < 0)
            y = -y;
         double s, angle;
         if (abs(y - 0.00) < 1e-5)
         {
             printf("%.2f\n", 0.00);
             continue;
         }
        double temp = y * 1.0 / x;
        angle = atan(temp);

        double l1, l2;
        l1 = a;
        double k = y * 1.0 / x;
        double x = (a*a*b*b) / (b*b + k*k*a*a);
        x = sqrt(x);
        l2 = x *1.0/ (cos(angle));
        s = 0.5 * l1 * l2 * angle;
        printf("%.2f\n", s);
    }
    return 0;
}

HDU 1714 math

标签:

原文地址:http://www.cnblogs.com/icode-girl/p/4668116.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!