题目链接: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. BZOJ3834 : [Poi2014]Solar Panels

    问题相当于找到一个最大的k满足在$[x_1,x_2]$,$[y_1,y_2]$中都有k的倍数 等价于$\frac{x_2}{k}>\frac{x_1-1}{k}$且$\frac{y_2}{k}& ...

  2. ios clang: error: linker command failed with exit code 1 (use -v to see invocation)解决方法

    当xcode编译时出现这个错误,一般是你的编译源码中存在重复的源码 解决方法:"Build Phases" -> "Compile Sources" 去删 ...

  3. object-c cocos2d-x 写程序时注意调试的技巧

    (1)写程序时最好在类的init函数中显示类名,表明现在在执行哪个类,样例代码 CCLOG(@"cocos2d: Using Director Type:%@", [self cl ...

  4. Linux_屏蔽360、scanv、QQ管家等IP扫描

    vi banip.sh #!/bin/bash echo "banip" iptables -A INPUT -s 221.204.203.0/24 -j DROP iptable ...

  5. Java递归搜索指定文件夹下的匹配文件

    import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Queue; /** ...

  6. <!--[if IE]>….<![endif]--> (<!--[if !IE]>||<![endif]-->)的用法

    1. <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--> 2. <!--[if IE]> 所有的IE可识别 ...

  7. dragloader.js帮助你在页面原生滚动下实现Pull Request操作

    dragloader.js是一个面向移动Web开发的JavaScript库,帮助开发者在使用页面原生滚动时,模拟上/下拉手势,实现Pull Request操作. 在移动设备上,一般会使用 drag d ...

  8. Nginx 报错: nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory) 的解决方法

    今天测试域名访问不了,登陆 Linux(Ubuntu)重启Nginx: nginx -s reload 结果报错: nginx: [error] open() : No such file or di ...

  9. PHP防止用户重复提交表单

    我们提交表单的时候,不能忽视的一个限制是防止用户重复提交表单,因为有可能用户连续点击了提交按钮或者是攻击者恶意提交数据,那么我们在提交数据后的处理如修改或添加数据到数据库时就会惹上麻烦. 那么如何规避 ...

  10. 页面静态化2 --- 使用PHP缓存机制来完成页面静态化(上)(ob_flush和flush函数区别用法)

    我们可以使用PHP自带的缓存机制来完成页面静态化,但在这里,需要说明一点,仅靠PHP缓存机制并不能完美的解决页面静态化,往往需要和其他页面静态技术(通常是伪静态技术)结合使用 例子: 当访问一个页面时 ...