uva 375 - Inscribed Circles and Isosceles Triangles
来源:互联网 发布:matlab矩阵元素运算 编辑:程序博客网 时间:2024/05/16 17:44
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 =B*H/(2*L+B)
pi的定义:const double pi=acos(-1.0);
#include <iostream>#include <cstring>#include <algorithm>#include <cstdio>#include <cmath>using namespace std;const double pi=acos(-1.0);int main(){ int t;double b,h,r,l; scanf("%d",&t); while(t--) { double sum=-2*pi; scanf("%lf%lf",&b,&h); r=1; while(r>0.000001) { sum+=r*pi*2; l=sqrt(h*h+b/4*b); r=b*h/(l+l+b); b=(h-2*r)/h*b; h=h-2*r; } printf("%13.6lf\n",sum); if(t) printf("\n"); } return 0;}
- 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
- B. Bets
- android静默安装的实现(turn)
- wince下获取mac地址的简单方法!
- ApiDemo学习 search 组件
- 几句话不容易做到,但还是拿来勉励一下自己
- uva 375 - Inscribed Circles and Isosceles Triangles
- wince中重启网卡
- 程序的内存布局篇
- 压缩感知进阶——有关稀疏矩阵
- VS2008 C# 检测到无法访问的代码的解决方法
- mybatis解析--转载
- Android源码编译整理总结
- 网卡MAC地址相关信息大全(整理)(下)
- Jquery三层实现删除功能