首页 > 其他 > 详细

UVa 375 内接圆和等腰三角形

时间:2014-02-25 15:07:47      阅读:368      评论:0      收藏:0      [点我收藏+]

/*

* 解题思路:

* 题意不难理解、一直求内接圆半径、知道半径长度小于0.000001为止

*/

#include <math.h>
#include <stdio.h>
int main( )
{
    int t;
    double x,y,r,sum;
    const double pi = 4.0 * atan( 1.0 );
    
    scanf("%d",&t);
    while( t-- )
    {
        scanf("%lf%lf",&x,&y);
        sum = 0; 
        r = tan( atan( y/x*2 ) /2 ) * x/2;
        while( r >= 0.000001 )
        {
            sum += r;  
            x = x/y*( y-2*r );
            y -= 2*r;   
            r = tan( atan( y/x*2 ) /2 ) * x/2;
        }
        printf("%13.6lf\n",sum*2*pi);
        if( t ) puts("");
    }
    return 0;
}


UVa 375 内接圆和等腰三角形

原文:http://blog.csdn.net/u011886588/article/details/19832109

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!