博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Uva 375 - Inscribed Circles and Isosceles Triangles
阅读量:5821 次
发布时间:2019-06-18

本文共 2321 字,大约阅读时间需要 7 分钟。

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
#include
#include
int main(){ double b, h, l, sum, temp, r ; double Pl = acos(-1.0); // 其实我只知道别人是用这个的,我AC前用3.14159265358都是WA呀 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*r*Pl; b = b*(h-2*r)/h, h = h - 2*r; } printf("%13.6lf\n", sum); if(T != 0) printf("\n"); } return 0;}

解题报告:

其实这题我不想写题解的,一是因为它简单,二是一个Pi的声明也用了我几个WA,但想到做人还是有始有终才行,所以……

转载于:https://www.cnblogs.com/liaoguifa/archive/2013/03/11/2954543.html

你可能感兴趣的文章
浮点数内存如何存储的
查看>>
贪吃蛇
查看>>
EventSystem
查看>>
用WINSOCK API实现同步非阻塞方式的网络通讯
查看>>
玩一玩博客,嘿嘿
查看>>
P1352 没有上司的舞会
查看>>
ios11文件夹
查看>>
【HLOJ 559】好朋友的题
查看>>
Electric Fence(皮克定理)
查看>>
nvl 在mysql中如何处理
查看>>
MyEclipse 快捷键
查看>>
快速傅里叶变换FFT
查看>>
大数据常用基本算法
查看>>
JavaScript学习笔记(十三)——生成器(generator)
查看>>
hibernate保存失败
查看>>
MySQL增量订阅&消费组件Canal POC
查看>>
Sqlite多线程
查看>>
数据结构-时间复杂度
查看>>
对象与字符串相互转换
查看>>
[NOIp2017提高组]小凯的疑惑
查看>>