zoukankan      html  css  js  c++  java
  • HDU 5858 Hard problem (数学推导)

    Hard problem

    题目链接:

    http://acm.split.hdu.edu.cn/showproblem.php?pid=5858

    Description

    cjj is fun with math problem. One day he found a Olympic Mathematics problem for primary school students. It is too difficult for cjj. Can you solve it? ![](http://images2015.cnblogs.com/blog/764119/201608/764119-20160818172426750-377270246.png) Give you the side length of the square L, you need to calculate the shaded area in the picture. The full circle is the inscribed circle of the square, and the center of two quarter circle is the vertex of square, and its radius is the length of the square.

    Input

    The first line contains a integer T(1<=T<=10000), means the number of the test case. Each case contains one line with integer l(1<=l<=10000).

    Output

    For each test case, print one line, the shade area in the picture. The answer is round to two digit.

    Sample Input

    1 1

    Sample Output

    0.29

    Source

    2016 Multi-University Training Contest 10
    ##题意: 求阴影面积.
    ##题解: 本渣不会算,只好百度搜图... (http://f.hiphotos.baidu.com/zhidao/pic/item/83025aafa40f4bfbde8267a0024f78f0f63618f7.jpg) (http://zhidao.baidu.com/question/571519797?&oldq=1)
    ![](http://images2015.cnblogs.com/blog/764119/201608/764119-20160818172723937-1109865998.png)

    ##代码: /*注释部分的公式也可以*/ ``` cpp #include #include #include #include #include #include #include #include #include #include #include #define LL long long #define eps 1e-8 #define maxn 110 #define mod 100000007 #define inf 0x3f3f3f3f #define mid(a,b) ((a+b)>>1) #define IN freopen("in.txt","r",stdin); using namespace std;

    int main(int argc, char const *argv[])
    {
    //IN;

    int t; cin >> t;
    while(t--)
    {
        double a; scanf("%lf", &a);
    
        //double ans = a*a/4.0 * asin(sqrt(14.0)/4.0);
        //ans -= a*a * asin(sqrt(14.0)/8.0);
        //ans += a*a * sqrt(7.0) / 8.0;
        //ans *= 2.0;
    
        double ans = atan(sqrt(7.0)) / 4.0;
        ans -= atan(sqrt(7.0)/5.0);
        ans += sqrt(7.0) / 8.0;
        ans *= a*a*2.0;
    
        printf("%.2f
    ", ans);
    }
    
    return 0;
    

    }

  • 相关阅读:
    error=Error Domain=NSURLErrorDomain Code=-1003
    修改mac host
    页面之间的跳转效果
    iOS开发200个tips总结(一)
    2020Python练习七——文件处理2
    2020python练习六——文件处理1
    【2020Python错题本】week1错误集
    【2020Python修炼记14】Python语法入门—文件处理
    【2020Python修炼记13】Python语法入门—字符编码
    2013年省赛I题 Thrall’s Dream
  • 原文地址:https://www.cnblogs.com/Sunshine-tcf/p/5784732.html
Copyright © 2011-2022 走看看