LightOj1137 - Expanding Rods(二分+数学)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1137
题意:有一根绳子的长度为l,在有温度的情况下会变形为一个圆弧,长度为 l1 = (n*c+1)*l;求图中的h;并说明增加的长度不超过原长度的一半;

我们可以二分h,然后根据h求弧长,比较一下和l1的长度即可;
把弧长公式记错我也是醉了;
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N = ;
const double eps = 1e-;
const double PI = acos(-); int main()
{
int T, t = ;
double n, c, l;
scanf("%d", &T);
while(T--)
{
scanf("%lf %lf %lf", &l, &n, &c);
double l1 = (n*c+)*l;
double left = , right = l/, ans = ;
while(right-left > eps)
{
double mid = (right + left)/;/// h;
double r = (l*l/+mid*mid)/(*mid);///半径r;
double a = *acos((r-mid)/r);///圆心角a,弧长公式a*r;
if(fabs(r*a-l1)<eps)
{
ans = mid;
///break;不能加这句...;
}
if(r*a < l1)
left = mid;
else
right = mid;
}
printf("Case %d: %.6f\n", t++, ans);
}
return ;
}
LightOj1137 - Expanding Rods(二分+数学)的更多相关文章
- Expanding Rods(二分POJ1905)
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 13688 Accepted: 3527 D ...
- 二分法 (UVA10668 Expanding Rods)(二分+几何)
转载请注明出处:優YoU http://user.qzone.qq.com/289065406/blog/1301845324 大致题意: 一根两端固定在两面墙上的杆 受热弯曲后变弯曲.求前后两个状态 ...
- Expanding Rods(二分)
Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 10287 Accepted: 2615 Description When ...
- POJ 1905 Expanding Rods 二分答案几何
题目:http://poj.org/problem?id=1905 恶心死了,POJ的输出一会要lf,一会要f,而且精度1e-13才过,1e-12都不行,错了一万遍终于对了. #include < ...
- poj 1905 Expanding Rods 二分
/** 题解晚上写 **/ #include <iostream> #include <math.h> #include <algorithm> #include ...
- UVA 10668 - Expanding Rods(数学+二分)
UVA 10668 - Expanding Rods 题目链接 题意:给定一个铁棒,如图中加热会变成一段圆弧,长度为L′=(1+nc)l,问这时和原来位置的高度之差 思路:画一下图能够非常easy推出 ...
- poj 1905 Expanding Rods(木杆的膨胀)【数学计算+二分枚举】
...
- 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 ...
- POJ 1905:Expanding Rods 求函数的二分
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 13780 Accepted: 3563 D ...
随机推荐
- 理解cookie的path和domain属性
今天在做验证码时发现一个问题:A.B窗口都打开同一个页面,A先生成一个验证码,B再生成验证码,这时A所生成的验证码被B覆盖掉了.原因是使用了同名的cookie来存储验证码.一时找不到解决方法就参考了W ...
- TYVJ P1074 武士风度的牛 Label:跳马问题
背景 农民John有很多牛,他想交易其中一头被Don称为The Knight的牛.这头牛有一个独一无二的超能力,在农场里像Knight一样地跳(就是我们熟悉的象棋中马的走法).虽然这头神奇的牛不能跳到 ...
- hdu Rescue
因为要求的是最少的时间,很明显的是一个利用优先队列的bfs的题目,题目很一般. #include"iostream" #include"algorithm" # ...
- 如何用JavaScript在页面上显示一个时间钟表
<html><head><script type="text/javascript">function myTime(){var today=n ...
- 【转】JavaScript顶级对象参考模型
- NVlink
Nvidia's Pascal to use stacked memory, proprietary NVLink interconnect by Scott Wasson — 6:50 PM on ...
- EditText小技巧
1.让EditText不自动获取焦点 将EditText的某个父级控件设置成 android:focusable="true" android:focusableInTouchMo ...
- 推荐25款php中非常有用的类库
推荐25款php中非常有用的类库 投稿:hebedich 字体:[增加 减小] 类型:转载 时间:2014-09-29 作为一个PHP开发者,现在是一个令人激动的时刻.每天有许许多多有用的库分发出 ...
- 20145235 《Java程序设计》实验二
实验内容 初步掌握单元测试和TDD 理解并掌握面向对象三要素:封装.继承.多态 初步掌握UML建模 熟悉S.O.L.I.D原则 了解设计模式 实验步骤 单元测试 代码及则是结果: public cla ...
- 前端框架Bootstrap的Modal使用Ajax数据源,如何避免数据被缓存
1.绑定事件,在关闭的时候,直接将数据清除: $("#model").on("hidden.bs.model",function(e){$(this).remo ...