09:膨胀的木棍 (二分+角度计算)

总时间限制: 
1000ms
 
内存限制: 
65536kB
描述

当长度为L的一根细木棍的温度升高n度,它会膨胀到新的长度L'=(1+n*C)*L,其中C是热膨胀系数。

当一根细木棍被嵌在两堵墙之间被加热,它将膨胀形成弓形的弧,而这个弓形的弦恰好是未加热前木棍的原始位置。

你的任务是计算木棍中心的偏移距离。

输入
三个非负实数:木棍初始长度(单位:毫米),温度变化(单位:度),以及材料的热膨胀系数。
保证木棍不会膨胀到超过原始长度的1.5倍。
输出
木棍中心的偏移距离(单位:毫米),保留到小数点后第三位。
样例输入
1000 100 0.0001
样例输出
61.329
来源
Waterloo local 2004.06.12
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
#define mem(s,t) memset(s,t,sizeof(s))
#define pq priority_queue
#define pb push_back
#define fi first
#define se second
#define ac return 0;
#define ll long long
#define rep(xx,yy) for(int i=xx;i<=yy;i++)
#define TLE std::ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);   cout.precision(10);
const double eps = 1e-14;
string str;
int main()
{
    TLE;
    double l,c,t;
    while(cin>>l>>t>>c)
    {
        double mx = l*(1+t*c);
        double left = 0 ,right = asin(1.0);
        while(left + eps < right )
        {
            double mid = (left+right)/2.0;
            if(mx*sin(mid)/mid<=l)
                right = mid;
            else
                left = mid;
        }
        printf("%.3lf
", l/2*tan(left/2));
    }
    return 0;
}
所遇皆星河
原文地址:https://www.cnblogs.com/Shallow-dream/p/11710001.html