zoukankan      html  css  js  c++  java
  • uva 375 Inscribed Circles and Isosceles Triangles

    错了好几次,因为在定义pi的时候直接标释成了3.1415926,不能直接标释成这个,要用到反三角函数,注意这点

    View Code
    #include<stdio.h>
    #include<math.h>
    const double pi = acos(-1.0);
    int main()
    {
        double b, h, r, t, _h, y;
        int T;
        scanf("%d",&T);
        while(T--)
        {
            scanf("%lf%lf",&b,&h);
            y = sqrt(h*h+b*b/4);
            t = b/(b+2*y);
            _h = h;
            r = t*_h;
            while(r >= 0.000001)
            {
                _h = _h-2*r;
                r = _h*t;
            }
          printf("%13.6lf\n",pi*(h-r/t));
          if(T)putchar('\n');
        }
    }
  • 相关阅读:
    php2
    11-14php
    三层嵌套
    常见的浏览器兼容
    css中的一些问题及解决方法
    css
    html
    测试题
    正则表达式
    Math对象
  • 原文地址:https://www.cnblogs.com/SDUTYST/p/2621381.html
Copyright © 2011-2022 走看看