POJ 1905 Expanding Rods (求直杆弯曲拱起的高度)(二分法,相交弦定理)
Description
When a thin rod of length L is heated n degrees, it expands to a new length L' = (1+n*C)*L, where C is the coefficient of heat expansion.
When a thin rod is mounted on two solid walls and then heated, it expands and takes the shape of a circular segment, the original rod being the chord of the segment.
Your task is to compute the distance by which the center of the rod is displaced. That means you have to calculate h as in the picture.
Input
Input starts with an integer T (≤ 20), denoting the number of test cases.
Each case contains three non-negative real numbers: the initial length of the rod in millimeters L, the temperature change in degrees n and the coefficient of heat expansion of the material C. Input data guarantee that no rod expands by more than one half of its original length. All the numbers will be between 0 and 1000 and there can be at most 5 digits after the decimal point.
Output
For each case, print the case number and the displacement of the center of the rod in single line. Errors less than 10-6 will be ignored.
Sample Input
3
1000 100 0.0001
150 10 0.00006
10 0 0.001
Sample Output
Case 1: 61.3289915
Case 2: 2.2502024857
Case 3: 0
若圆内任意弦AB、弦CD交于点P,则PA·PB=PC·PD(相交弦定理)
sinB=L/R B=asin(L/R) 反三角函数。
#include<cstdio>
#include<cmath>
int main()
{
int t;
scanf("%d",&t);
int num=;
while(t--)
{
double l,n,c,L,le,ri,r,mid;
scanf("%lf %lf %lf",&l,&n,&c);
L=(+n*c)*l;
le=;
ri=l/;
while(ri-le>1e-)
{
mid=(le+ri)/;
r=l*l//mid+mid/;
if(r**(asin(l//r))<L)
{
le=mid;
}
else
{
ri=mid;
}
}
printf("Case %d: ",++num);
printf("%.6f\n",le);
}
}
最新文章
- VC++6.0文件关联问题的解决方法
- 在IIS下部署Thinkphp项目,验证码不能显示的解决办法
- 动画黄金搭档:CADisplayLink &; CAShapeLayer
- zabbix3.x搭建(1)
- VMWare安装Solaris虚拟机的网络设置
- OpenGIS Simple feature access
- pg_dump 备份与恢复的简单操作
- dzzoffice注册开启
- VSS 之 未知的用户名或密码错误
- 在Vim里使用gtags-cscope
- Windows下Android SDK Manage下载速度缓慢的解决方法
- javaweb分页思想
- c++,给常成员变量赋值
- Swift - 使用UIWebView和UIToolbar制作一个浏览器
- 从A页面跳转到B页面,从B页面按浏览器自带按钮返回到A页面并且刷新页面--手机操作浏览器自带返回并自带刷新
- HTML5学习笔记四:html5结构
- hive、impala集成ldap
- 利用QuickCHM制作chm
- js知识点总结
- Apache JMeter压力测试实例