Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 10287   Accepted: 2615

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.

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.0001
15000 10 0.00006
10 0 0.001
-1 -1 -1

Sample Output

61.329
225.020
0.000 题意:一个固定在两面墙之间的杆,受热会变长从而弯曲,问弯曲前后杆中点间的距离;
思路:直接二分弯曲弧度,二分区间为(0,pi),推导出弧度与弯曲后长度LL之间的关系,注意精度还有特判,当L,n,c有一个为0时输出0;
 #include<stdio.h>
#include<string.h>
#include<math.h>
const double eps = 1e-; int main()
{
double L,n,c;
while(~scanf("%lf %lf %lf",&L,&n,&c))
{
if(L< && n< && c<)
break;
if(L == || n == || c == )
{
printf("0.000\n");
continue;
} double LL = (+n*c)*L;
double min = ,max = acos(-1.0),mid; while(max-min > eps)//二分弧度
{
mid = (max+min)/;
if(*LL/L > mid/sin(mid/))
min = mid;
else max = mid;
}
printf("%.3lf\n",LL/mid * (-cos(mid/)));
}
}

Expanding Rods(二分)的更多相关文章

  1. Expanding Rods(二分POJ1905)

    Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13688   Accepted: 3527 D ...

  2. 二分法 (UVA10668 Expanding Rods)(二分+几何)

    转载请注明出处:優YoU http://user.qzone.qq.com/289065406/blog/1301845324 大致题意: 一根两端固定在两面墙上的杆 受热弯曲后变弯曲.求前后两个状态 ...

  3. POJ 1905 Expanding Rods 二分答案几何

    题目:http://poj.org/problem?id=1905 恶心死了,POJ的输出一会要lf,一会要f,而且精度1e-13才过,1e-12都不行,错了一万遍终于对了. #include < ...

  4. poj 1905 Expanding Rods 二分

    /** 题解晚上写 **/ #include <iostream> #include <math.h> #include <algorithm> #include ...

  5. UVA 10668 - Expanding Rods(数学+二分)

    UVA 10668 - Expanding Rods 题目链接 题意:给定一个铁棒,如图中加热会变成一段圆弧,长度为L′=(1+nc)l,问这时和原来位置的高度之差 思路:画一下图能够非常easy推出 ...

  6. POJ 1905:Expanding Rods 求函数的二分

    Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13780   Accepted: 3563 D ...

  7. D - Expanding Rods POJ - 1905(二分)

    D - Expanding Rods POJ - 1905 When a thin rod of length L is heated n degrees, it expands to a new l ...

  8. POJ 1905 Expanding Rods(二分)

    Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 20224 Accepted: 5412 Descr ...

  9. poj 1905 Expanding Rods(木杆的膨胀)【数学计算+二分枚举】

                                                                                                         ...

随机推荐

  1. 事件触发函数中的this,target,currentTarget,srcElement

    要解释其中的区别,首先要理解浏览器的事件机制, 现在主流的浏览器事件基本是先捕获再冒泡,IE浏览器只有冒泡阶段 事件是在冒泡阶段触发的 看看这个HTML 当我点击"我是父节点的时候" ...

  2. 处理ASP.NET 请求(IIS)

    原文:http://www.cnblogs.com/hkncd/archive/2012/03/23/2413917.html 英文原文:Beginner’s Guide: How IIS Proce ...

  3. StringHelper类,内容截取,特别适合资讯展示列表

    public class StringHelper    {        /// <summary>        /// 截字符串        /// </summary> ...

  4. OpenSSL安装及目录介绍

    1. 下载安装OpenSSL 2. 根据需要下载安装Visual C++ Redistributable 3. 安装完成OpenSSL后,目录结构如下所示 其中,bin文件夹下是OpenSSL主程序的 ...

  5. 微信小程序开发之 下拉刷新,上拉加载更多

    本文记载了如何在微信小程序里面实现下拉刷新,上拉加载更多 先开看一下界面 大致如此的界面吧. 这个Demo使用了微信的几个Api和事件,我先列出来. 1.wx.request (获取远程服务器的数据, ...

  6. 打开自定义链接新窗口(safari JS prompt的坑!)2016.03.08

    很简单的一个小练习,但做的过程中发现safari的一个坑,使用prompt()方法的时候,点击取消和不输入一样,会返回空字符' ',而不是null! 要求: 制作新按钮,"新窗口打开网站&q ...

  7. mysql更新密码为空

    1.进入命令行 mysql -u root -p 'oldpassword'; 2 修改root用户的密码:mysql> update mysql.user set password=PASSW ...

  8. 每天一条linux命令——login

    login命令用于给出登录界面,可用于重新登录或者切换用户身份,也可通过它的功能随时更换登入身份.当/etc/nologin文件存在时,系统只root帐号登入系统,其他用户一律不准登入. 语法: lo ...

  9. login-登录

    <!DOCTYPE html><html><head><meta charset="UTF-8"><title>Inse ...

  10. Js regular exprission

    正则表达式用于字符串处理.表单验证等场合,实用高效.现将一些常用的表达式收集于此,以备不时之需. 匹配中文字符的正则表达式: [\u4e00-\u9fa5] 评注:匹配中文还真是个头疼的事,有了这个表 ...