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);
}
}
POJ 1905 Expanding Rods (求直杆弯曲拱起的高度)(二分法,相交弦定理)的更多相关文章
- poj 1905 Expanding Rods(木杆的膨胀)【数学计算+二分枚举】
...
- POJ 1905 Expanding Rods
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 1 ...
- POJ 1905 Expanding Rods 木棍膨胀
描述 当长度为L的一根细木棍的温度升高n度,它会膨胀到新的长度L'=(1+n*C)*L,其中C是热膨胀系数. 当一根细木棍被嵌在两堵墙之间被加热,它将膨胀形成弓形的弧,而这个弓形的弦恰好是未加热前木棍 ...
- POJ 1905 Expanding Rods(二分)
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 20224 Accepted: 5412 Descr ...
- POJ - 1905 Expanding Rods(二分+计算几何)
http://poj.org/problem?id=1905 题意 一根两端固定在两面墙上的杆,受热后变弯曲.求前后两个状态的杆的中点位置的距离 分析 很明显需要推推公式. 由②的限制条件来二分角度, ...
- POJ 1905 Expanding Rods 二分答案几何
题目:http://poj.org/problem?id=1905 恶心死了,POJ的输出一会要lf,一会要f,而且精度1e-13才过,1e-12都不行,错了一万遍终于对了. #include < ...
- poj 1905 Expanding Rods (数学 计算方法 二分)
题目链接 题意:将长度为L的棒子卡在墙壁之间.现在因为某种原因,木棒变长了,因为还在墙壁之间,所以弯成了一个弧度,现在求的是弧的最高处与木棒原先的地方的最大距离. 分析: 下面的分析是网上别人的分析: ...
- POJ 1905 Expanding Rods( 二分搜索 )
题意:一个钢棍在两面墙之间,它受热会膨胀成一个圆弧形物体,这个物体长 S = ( 1 + n * C ) * L,现在给出原长 L ,温度改变量 n ,和热膨胀系数 C,求膨胀后先后中点的高度差. 思 ...
- poj 1905 Expanding Rods 二分
/** 题解晚上写 **/ #include <iostream> #include <math.h> #include <algorithm> #include ...
随机推荐
- css - 单词的自动换行问题
转载自:解决文档中有url链接时被强制换行的问题 问题 当行内出现很长的英文单词或者url的时候,会出现自动换行的问题,为了美化页面,往往会希望这些很长的英文单词或者url能够断开来,超出的部分换行到 ...
- 使用Ctex中遇到的一些问题
一般下载好Ctex,我是使用Latex+dvi2pdf完成编译的,但是发现推荐的使用为:1)运行CCT & Latex命令生成两次dvi和ps文件 2)使用dvi2pdf编译dvi文件生成pd ...
- sql基础语法-创建表和约束
创建数据库表 USE SQL2016 IF OBJECT_ID('dbo.Employees','U') IS NOT NULL DROP TABLE dbo.Employees; Create TA ...
- eclipse快捷键,移动和复制一段代码
移动代码:alt+上或下箭头 复制加移动代码:ctrl + alt + 上或下箭头
- JVM初探
### JVM分为类的加载生命周期和gc垃圾回收两个大的方面#####首先是类的生命周期, 类的加载: --> 记载字节码 ---> 这个过程有类的加载起参与,双亲委托机制() --> ...
- 最优雅退出 Android 应用程序的 6 种方式
一.容器式 建立一个全局容器,把所有的Activity存储起来,退出时循环遍历finish所有Activity import java.util.ArrayList; import java.util ...
- NestedScrollView嵌套RecycleView发生的小问题
1.解决方法:嵌套滑动不激活. recycleView.setNestedScrollingEnable(false); 这样做有个弊端,RecycleView的item会一次性加载完,不管是否显示, ...
- 如何优化APK的大小
项目使用AS打出的包明显比Eclipse打出的包要大一些,还是蛮费解.于是百度了一翻, 原来Eclipse使用的proguard能够遍历所有的java代码,把无用的代码去掉才生成dex文件,同 时对r ...
- 秒杀Sublime Text的微软开源代码编辑工具Visual Studio Code
1. 下载链接: https://code.visualstudio.com/ 2. 秒开一个ASP.NET网站源码 3.编辑CSS颜色支持 4.Git支持 5.常用快捷键 Ctrl+Shift+P ...
- TFS强制删除离职人员签出锁定项的方法(转)
项目组一哥们走的时候以独占方式迁出了文件,现在其他人都无法修改,管理员似乎也无法将文件解除.经过摸索,找到了一种暴力的方法——直接改TFS数据库.虽然暴力,却能实实在在地解决这个问题. 步骤: 1 ...