题目链接: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(二分+数学)的更多相关文章

  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. Expanding Rods(二分)

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

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

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

  5. poj 1905 Expanding Rods 二分

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

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

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

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

                                                                                                         ...

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

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

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

随机推荐

  1. COJ0702 数学(三)

    数学(三) 难度级别:D: 运行时间限制:1800ms: 运行空间限制:262144KB: 代码长度限制:2000000B 试题描述 给出两个正整数a,b,求a*b. 输入 输入共两行,每行是一个正整 ...

  2. JS模态窗口返回值兼容问题解决方案

    因系统要兼容原IE已使用的关闭方法,经调试测得,需对window.dialogArguments进行再较验,不然易出问题. function OKEnd(vals) { if (vals == nul ...

  3. 运行时(iOS)

    运行时(iOS)   一.什么是运行时(Runtime)? 运行时是苹果提供的纯C语言的开发库(运行时是一种非常牛逼.开发中经常用到的底层技术) 二.运行时的作用? 能获得某个类的所有成员变量 能获得 ...

  4. The Stable Marriage Problem

    经典稳定婚姻问题 “稳定婚姻问题(The Stable Marriage Problem)”大致说的就是100个GG和100个MM按照自己的喜欢程度给所有异性打分排序.每个帅哥都凭自己好恶给每个MM打 ...

  5. sheet目标数据插入函数主键模块

    #coding:gbk #导入处理excel的模块 import xlrd #定义哪些字段需要判断,只支持时间字段 toSureColArray = ['CREATE_TIME','MODIFY_TI ...

  6. Error 2147943712 during task creation

    In a Windows 2008 server, when you confirm the creation of a new task, you may obtain the following ...

  7. $.each(),$.map()归纳

    //$.each()对字典(没有索引).数组(有索引) 遍历 //两个参数 var json={"name":"李可","age":&quo ...

  8. 做了一个简易的git 代码自动部署脚本

    做了一个简易的git 代码自动部署脚本 http://my.oschina.net/caomenglong/blog/472665 发表于2个月前(2015-06-30 21:08)   阅读(200 ...

  9. Moving in Unity

    转自:http://angryant.com/2014/03/07/Moving-in-Unity/ ,详细描述了物体在unity中移动的几种方式,并且给出了代码描述,对加深对Unity理解很有帮助, ...

  10. DirectX 基础学习系列5 纹理映射

    1 纹理坐标 类似BMP图像坐标系,左上为原点 纹理坐标为了规范化,范围限定在[0,1]之间,使用纹理的时候,需要修改顶点结构 struct ColorVetex { float x, y,z; fl ...