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;
    

    }

  • 相关阅读:
    SSM项目使用GoEasy 实现web消息推送服务
    Spring中RedirectAttributes的用法
    Mybatis传递多个参数
    Mysql异常之——Packet for query is too large (10240 > 1024). You can change this value
    记自己在mybatis中设置jdbcType的一个坑
    Linux中各个目录作用
    Linux启动/停止/重启Mysql数据库
    ssm项目跨域访问
    Mybatis异常之——NoSuchMethodException
    Tomcat异常之——启动报错Failed to start component
  • 原文地址:https://www.cnblogs.com/Sunshine-tcf/p/5784732.html
Copyright © 2011-2022 走看看