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 ...
随机推荐
- Session赋值(备注)
Session赋值也是在后台赋,不是在前台赋 追问 不好意思 那还真能在AJAX中赋值 我已经解决了 加一个接口IRequiresSessionState 就OK 提问者评价 太感谢了,真心有用
- c++ stack 的使用
(1) stack::empty bool empty ( ) const; 判断是否为空. return Value : true if the container size is 0, false ...
- uva10098 Generating Fast, Sorted Permutation
#include"iostream"#include"stdio.h"#include"string.h"#include"alg ...
- appSetting 在单独文件的读写
#region appSetting /// <summary> /// 设定 appSetting /// </summary> /// <param name=&qu ...
- Reset RequiredFieldValidator 重置 验证控件
<td style="width:100px;">姓名<span class="must_star">*</span>< ...
- CodeForces 86D Powerful array(莫队+优化)
D. Powerful array time limit per test 5 seconds memory limit per test 256 megabytes input standard i ...
- ThinkPHP 学习笔记 ( 四 ) 数据库操作之关联模型 ( RelationMondel ) 和高级模型 ( AdvModel )
一.关联模型 ( RelationMondel ) 1.数据查询 ① HAS_ONE 查询 创建两张数据表评论表和文章表: tpk_comment , tpk_article .评论和文章的对应关系为 ...
- UItableview里面的header、footer
#import "ViewController.h" #import "MJRefresh.h" @interface ViewController () { ...
- 20145235 《Java程序设计》第8周学习总结
教材学习内容总结 15.1.1日志API简介 使用日志的起点是logger类,logger实例的创建有许多要处理的要素,必须使用logger的静态方法getLogger(). 通常在哪个类上取得的lo ...
- memcached学习笔记6--浅谈memcached的机制 以及 memcached细节讨论
附:请浅谈memcached的机制 答: ①基于C/S架构,协议比较简单 c/s架构,此时memcached为服务器端,我们可以使用如PHP,c++/c等程序连接memcached服务器. memca ...