POJ1905 Expanding Rods
来源:互联网 发布:小学作文解答软件 编辑:程序博客网 时间:2024/05/08 15:43
Problem 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.
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.
Input
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.000115000 10 0.0000610 0 0.001-1 -1 -1
Sample Output
61.329225.0200.000弧长公式:l=a*r(a是弧所对圆心角)假设半径r已知,用r和l/2表示出a,将求得的膨胀后的弧长与所给数值比较。#include<stdio.h>#include<math.h>double c,t,n;int main(){double l,r,mid,p,q,L;while(scanf("%lf%lf%lf",&t,&n,&c)&&t>=0&&n>=0&&c>=0){L=(1+c*n)*t;l=0;r=t/2.0;while(r-l>1e-6){mid=(l+r)/2;p=(t*t/4+mid*mid)/(2*mid);q=2*p*asin(t/(2*p));if(L<q)r=mid;elsel=mid;}mid=(l+r)/2;printf("%.3f\n",mid);}return 0;}
0 0
- POJ1905 Expanding Rods 二分
- POJ1905:Expanding Rods
- POJ1905 Expanding Rods
- POJ1905--Expanding Rods
- POJ1905 Expanding Rods
- poj1905 Expanding Rods
- POJ1905 Expanding Rods
- poj1905 Expanding Rods 二分
- 二分 poj1905 Expanding Rods
- POJ1905-Expanding Rods - 二分法。
- Expanding Rods(二分POJ1905)
- POJ1905-----Expanding Rods
- Expanding Rods<poj1905>
- POJ1905[Expanding Rods]题解
- poj1905 Expanding Rods
- [POJ1905]Expanding Rods
- POJ1905 Expanding Rods(二分)
- POJ1905 Expanding Rods 题解&代码
- iOS 小心删除Documents中的文件
- Android Tabhost使用
- 学习make(七)
- DAY 001 简单知识与常用技巧
- 关于数码相机的像素、分辨率和图片大小的概念
- POJ1905 Expanding Rods
- 一个老程序员的心里话!
- 优先队列DIY
- 关于我们
- Python基本规范
- Servlet映射地址配置
- 关于jsp页面margin:0 auto;失效导致不居中的问题
- 实用的java 串口通信程序
- css中的clear属性