Expanding Rods解题报告

原创 2012年03月25日 20:28:53

The input contains multiple lines. Each line of input contains three non-negative numbers: the initial lenth of the rod in millimeters, the temperature change in degrees and the coefficient of heat expansion of the material. Input data guarantee that no rod expands by more than one half of its original length. The last line of input contains three negative numbers and it should not be processed.

Output

For each line of input, output one line with the displacement of the center of the rod in millimeters with 3 digits of precision.

Sample Input

1000 100 0.0001
15000 10 0.00006
10 0 0.001
-1 -1 -1

Sample Output

61.329
225.020
0.000
#include<iostream>
#include<cmath>
using namespace std;
const double ep=1e-12;
const double pi=acos(0.0);
int main()
{
	double n,c,L;
	while(scanf("%lf%lf%lf",&L,&n,&c)!=EOF)
	{
		if(L==-1&&n==-1&&c==-1)
			break;
		else
		{ 
			double a;
			a=(1+n*c)*L;   //L'的公式。
			double low=0,high=pi,mia;
			while(low+ep<high)  //精确范围。
			{
				mia=(low+high)/2.0;  //(0,PI)中二分查找。
				if(sin(mia)/mia>L/a)  
				{
					low=mia;
				}
				else
					high=mia;
			}
			printf("%.3lf\n",(1-cos(high))*L/(2*sin(high)));
		}
	}
	return 0;
}

POJ 1905 Expanding Rods

题目大意: 一根某种材料做的直杆被夹在两面墙之间,当他受热时长度会变长,就会因两面墙的挤压而向上隆起。长度变化函数为 L'=(1+n*C)*L,给定L,C,n,求向上拱起的高度H。 解题思路: ...
  • lin375691011
  • lin375691011
  • 2014-01-01 21:53:32
  • 5121

FOJ 1083 Expanding Rods

 http://acm.fzu.edu.cn/problem.php?pid=1083 题目大意:路面热胀冷缩会使的路面膨胀起来形成一个拱形,叫你求拱形中心离地面多远。给定你C,n根据公式可以求出拱形...
  • q3498233
  • q3498233
  • 2009-08-04 21:38:00
  • 591

FOJ--1083--Expanding Rods--解题报告

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 ...
  • xiaotaoqibao
  • xiaotaoqibao
  • 2009-08-04 18:57:00
  • 712

Expanding Rods+二分高精度+POJ

Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 11473  ...
  • u012870383
  • u012870383
  • 2014-07-31 23:30:03
  • 347

Expanding Rods-二分

A - Expanding Rods Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u ...
  • qq_18661257
  • qq_18661257
  • 2015-07-23 22:51:53
  • 594

POJ 1905 Expanding Rods 二分加数学公式的推导

点击打开链接 题意:给你一个L长的细棒然后将他卡在两个板子之间进行加热 ,然后他会变成长度为 S=L*(1+n*c)的弧线棒 求出该弧线棒的中心比以前高出多少(H) 思路:     已知 ...
  • became_a_wolf
  • became_a_wolf
  • 2016-02-24 20:55:20
  • 173

POJ1905-Expanding Rods

转载请注明出处:優YoU http://user.qzone.qq.com/289065406/blog/1301845324   大致题意: 一根两端固定在两面墙上的杆 受热弯曲后变弯曲 ...
  • lyy289065406
  • lyy289065406
  • 2011-07-31 16:43:20
  • 3837

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...
  • angle555945
  • angle555945
  • 2012-03-16 01:11:09
  • 739

Expanding Rods(数学公式推导+二分)

Link:http://poj.org/problem?id=1905 Expanding Rods Time Limit: 1000MS   ...
  • Enjoying_Science
  • Enjoying_Science
  • 2015-02-21 23:32:26
  • 805

I - Expanding Rods解题报告(黄杰)

I - Expanding Rods Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u ...
  • CSUST_ACM
  • CSUST_ACM
  • 2012-03-21 13:46:20
  • 3282
收藏助手
不良信息举报
您举报文章:Expanding Rods解题报告
举报原因:
原因补充:

(最多只允许输入30个字)