http://www.lightoj.com/volume_showproblem.php?problem=1137

题意:一根长度为L的杆热膨胀为L',左端点到右端点间距离不变,且膨胀后的杆的弧为圆形的一部分。

思路:由于弧度值是固定在0~PI间,所以直接二分弧度制,通过初中学的弧度公式换算一下就行了,之前精度总是达不到要求,其实eps设的更小点就行了...

/** @Date    : 2016-12-11-21.41
* @Author : Lweleth (SoungEarlf@gmail.com)
* @Link : https://github.com/
* @Version :
*/
#include<bits/stdc++.h>
#define LL long long
#define PII pair
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std; const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-15;
const double PI = acos(-1.00); int main()
{
int T;
int cnt = 0;
cin >> T;
while(T--)
{
double l, n, c;
cin >> l >> n >> c;
double lx = l * (1 + n * c); double ll = 0;
double rr = PI;
double ans = -1;
while(fabs(ll - rr) > eps)
{
double m = (ll + rr) / 2.00;
double r = lx / m;
double ly = 2*r * sin(m / 2);
ans = lx / m * (1 - cos(m / 2));
if(fabs(ly - l) < eps)
break;
else if(ly < l)
rr = m;
else if(ly > l)
ll = m;
//cout << ly << endl;
}
printf("Case %d: %.9lf\n", ++cnt, ans);
}
return 0;
}

LightOJ 1137 - Expanding Rods 基础计算几何的更多相关文章

  1. 1137 - Expanding Rods

    1137 - Expanding Rods    PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 M ...

  2. LightOJ 1062 - Crossed Ladders 基础计算几何

    http://www.lightoj.com/volume_showproblem.php?problem=1062 题意:问两条平行边间的距离,给出从同一水平面出发的两条相交线段长,及它们交点到水平 ...

  3. POJ 1905 Expanding Rods

                           Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1 ...

  4. Expanding Rods(二分POJ1905)

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

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

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

  6. UVA 10668 Expanding Rods

    Problem A: Expanding Rods When a thin rod of length L is heated n degrees, it expands to a new lengt ...

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

                                                                                                         ...

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

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

  9. 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 ...

随机推荐

  1. codeforces 228E The Road to Berland is Paved With Good Intentions(2-SAT)

    Berland has n cities, some of them are connected by bidirectional roads. For each road we know wheth ...

  2. 软件功能-东北师大站-第三次作业(PSP)

    1.本周PSP 2.本周进度条 3.本周累计进度图 代码累计折线图 博文字数累计折线图 本周PSP饼状图

  3. matlab 直方图均衡化(含rgb)

    步骤: 统计原图像素每个像素的个数 统计原图像<每个灰度级的像素的累积个数 家里灰度级得映射规则 将原图每个像素点的灰度映射到新图 代码: clear all I=imread('1.jpg') ...

  4. Android框架 与 源码结构

    一. Android 框架 Android框架层级 : Android 自下 而 上 分为 4层; -- Linux内核层; -- 各种库 和 Android运行环境层; -- 应用框架层; -- 应 ...

  5. iOS- 网络访问两种常用方式【GET & POST】实现的几个主要步骤

    1.前言 上次,在博客里谈谈了[GET & POST]的区别,这次准备主要是分享一下自己对[GET & POST]的理解和实现的主要步骤. 在这就不多废话了,直接进主题,有什么不足的欢 ...

  6. Launch Image消失时添加动画

    CGSize viewSize = self.window.bounds.size; NSString *viewOrientation = @"Portrait"; //横屏请设 ...

  7. 【Redis】- 主从复制

    Redis跟MySQL一样,拥有非常强大的主从复制功能,而且还支持一个master可以拥有多个slave,而一个slave又可以拥有多个slave,从而形成强大的多级服务器集群架构. redis的主从 ...

  8. tcp传送报文

    707 void tcp_init_xmit_timers(struct sock *sk)708 {709     inet_csk_init_xmit_timers(sk, &tcp_wr ...

  9. touchSwipe 上下左右滑动,二指缩放 效果不好。

    $(function(){ var _showImgW; var _showImgH; var _showImgMT; var _showImgML; $("#imgDiv").s ...

  10. react-event-pooling

    react-event-pooling 事件池 https://codesandbox.io/s/3xp4y9zp7q https://reactjs.org/docs/events.html#eve ...