uva 375 - Inscribed Circles and Isosceles Triangles
来源:互联网 发布:java action models 编辑:程序博客网 时间:2024/06/02 08:48
Inscribed Circles and Isosceles Triangles
Given two real numbers
- B
- the width of the base of an isosceles triangle in inches
- H
- the altitude of the same isosceles triangle in inches
Compute to six significant decimal places
- C
- the sum of the circumferences of a series of inscribed circles stacked one on top of another from the base to the peak; such that the lowest inscribed circle is tangent to the base and the two sides and the next higher inscribed circle is tangent to the lowest inscribed circle and the two sides, etc. In order to keep the time required to compute the result within reasonable bounds, you may limit the radius of the smallest inscribed circle in the stack to a single precision floating point value of 0.000001.
For those whose geometry and trigonometry are a bit rusty, the center of an inscribed circle is at the point of intersection of the three angular bisectors.
Input
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.
The input will be a single line of text containing two positive single precision real numbers (B H) separated by spaces.
Output
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
The output should be a single real number with twelve significant digits, six of which follow the decimal point. The decimal point must be printed in column 7.
Sample Input
10.263451 0.263451
Sample Output
0.827648
求等腰三角形的内切圆周长,内切圆不止一个,切完一个继续内切知道r《=0.000001;
设初始的内切圆半径为R;
勾股定理 斜边L=sqrt(R*R+B*B\4);
接下来求R有2种方法;
1继续用勾股定理:(L-B/2)^2+R^2=(H-R)^2 R=sqrt(H*H+B*B/4); R=R-B/2; R=(R*R-H*H)/(-2*H);
2.面积法:R*L+R*B/2=B*H/2; R =B*H/(2*L+B);
#include<stdio.h>
#include<math.h>
#define pi asin(1.0)*2
void main()
{double B,H,r,h,R;
int t;
scanf("%d",&t);
while (t--)
{
scanf("%lf%lf",&B,&H);
R=sqrt(H*H+B*B/4);
R =B*H/(2*R+B);
h=H; r=R;
while (r>=0.000001)
{h=h-2*r;
r=R*h/H;
}
printf("%13lf\n",(H-h)*pi);
if (t) printf("\n");
}
}
- uva 375 - Inscribed Circles and Isosceles Triangles
- UVA 375 - Inscribed Circles and Isosceles Triangles
- Uva 375 - Inscribed Circles and Isosceles Triangles
- uva 375 - Inscribed Circles and Isosceles Triangles
- UVA 375 Inscribed Circles and Isosceles Triangles
- UVA 375Inscribed Circles and Isosceles Triangles
- uva 375 Inscribed Circles and Isosceles Triangles
- UVa 375 - Inscribed Circles and Isosceles Triangles
- UVa - 375 - Inscribed Circles and Isosceles Triangles
- UVa 375 - Inscribed Circles and Isosceles Triangles
- Uva 375 Inscribed Circles and Isosceles Triangles
- UVA - 375 Inscribed Circles and Isosceles Triangles
- UVa 375 Inscribed Circles and Isosceles Triangles
- UVA - 375 Inscribed Circles and Isosceles Triangles
- UVA - 375 Inscribed Circles and Isosceles Triangles
- UVA 375 Inscribed Circles and Isosceles Triangles
- UVA - 375 Inscribed Circles and Isosceles Triangles
- UVA - 375 Inscribed Circles and Isosceles Triangles
- .Net执行cmd命令
- linux常用文件处理命令——课堂笔记
- SQL Server2012 T-SQL对分页的增强尝试
- android 人脸识别
- IE10中的无前缀CSS3渐变
- uva 375 - Inscribed Circles and Isosceles Triangles
- Oracle语句优化
- Android 之Adapter
- fastcgi
- 关于值类型和引用类型
- 20120709-the key factor affecting explicit or implicit interface implementation
- grep总结
- flex4 学习笔记-flex项目渲染器
- 关于堆和栈