uva 375

来源:互联网 发布:河南软件集成商 编辑:程序博客网 时间:2024/06/05 23:23

题意:给你等腰三角形的高和底,求在半径不小于给定值的时候,连续内切圆的周长和 ,水题,画图就可以做出来了

#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;int main(){    double b,h,l,sum,temp,r;    double PI = acos(-1.0);    int t;    scanf("%d",&t);    while (t--)    {        sum = l = r = 0 ;        scanf("%lf%lf",&b,&h);        while (1)        {            l = atan(h/(b/2));            r = tan(l/2)*b/2;            if (r < 0.000001 )                break;            sum += 2*PI*r;            b = (h-2*r)/h*b;            h = h - 2 * r ;        }        printf("%13.6lf\n",sum);        if( t )            printf("\n");    }    return 0 ;}



原创粉丝点击