zoukankan      html  css  js  c++  java
  • HDU 1714 math

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

    int main()
    {
        int n;
        double a, b, px, py;
        cin >> n;
        while(n--)
        {
            cin >> a >> b >> px >> py;
            if (py < 0)
                py = -py;
            else if (py == 0)
            {
                cout << setprecision(2) << 0.00 << endl;
                continue;
            }
            double jx, jy, k;
            k = py * 1.0 / px;
            jx = (a * a * b * b) / (b * b + a * a * k * k);
            jx = sqrt(jx);
            jy = k * jx;
            double angle = atan(py * 1.0 / px);
            double s1 = (0.5 * a * b * angle) - (0.25 * a * b * sin(2 * angle));
            double s2 = 0.5 * jx * jy;
            double s = s1 + s2;
            cout << setprecision(2) << s << endl;
        }
        return 0;
    }

  • 相关阅读:
    LeetCode 260
    LeetCode 258
    LeetCode 237
    LeetCode 226
    LeetCode 203
    LeetCode 202
    codeforces 7D
    codefroces 7C
    codeforces 7B
    codeforces 6E (非原创)
  • 原文地址:https://www.cnblogs.com/icode-girl/p/4668116.html
Copyright © 2011-2022 走看看