POJ 1905 Expanding Rods 二分答案几何
题目:http://poj.org/problem?id=1905
恶心死了,POJ的输出一会要lf,一会要f,而且精度1e-13才过,1e-12都不行,错了一万遍终于对了。
#include <stdio.h>
#include <math.h> int main()
{
double l, n, c, r;
while(scanf("%lf %lf %lf", &l, &n, &c) != EOF)
{
if(l < && n < && c < )break;
double arc = ( + n*c) * l;
double low = , high = acos(-1.0) / ;
while(high-low > 1e-)
{
double mid = (high+low) / ;
r = l/ / sin(mid);
if(r * mid < arc / )
{
low = mid;
}
else
{
high = mid;
}
}
printf("%.3lf\n", r-r*cos(low));
}
return ;
}
POJ 1905 Expanding Rods 二分答案几何的更多相关文章
- poj 1905 Expanding Rods 二分
/** 题解晚上写 **/ #include <iostream> #include <math.h> #include <algorithm> #include ...
- POJ 1905 Expanding Rods(二分)
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 20224 Accepted: 5412 Descr ...
- poj 1905 Expanding Rods(木杆的膨胀)【数学计算+二分枚举】
...
- POJ 1905 Expanding Rods
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 1 ...
- POJ - 1905 Expanding Rods(二分+计算几何)
http://poj.org/problem?id=1905 题意 一根两端固定在两面墙上的杆,受热后变弯曲.求前后两个状态的杆的中点位置的距离 分析 很明显需要推推公式. 由②的限制条件来二分角度, ...
- poj 1905 Expanding Rods (数学 计算方法 二分)
题目链接 题意:将长度为L的棒子卡在墙壁之间.现在因为某种原因,木棒变长了,因为还在墙壁之间,所以弯成了一个弧度,现在求的是弧的最高处与木棒原先的地方的最大距离. 分析: 下面的分析是网上别人的分析: ...
- POJ 1905 Expanding Rods 木棍膨胀
描述 当长度为L的一根细木棍的温度升高n度,它会膨胀到新的长度L'=(1+n*C)*L,其中C是热膨胀系数. 当一根细木棍被嵌在两堵墙之间被加热,它将膨胀形成弓形的弧,而这个弓形的弦恰好是未加热前木棍 ...
- POJ 1905 Expanding Rods (求直杆弯曲拱起的高度)(二分法,相交弦定理)
Description When a thin rod of length L is heated n degrees, it expands to a new length L' = (1+n*C) ...
- POJ 1905 Expanding Rods( 二分搜索 )
题意:一个钢棍在两面墙之间,它受热会膨胀成一个圆弧形物体,这个物体长 S = ( 1 + n * C ) * L,现在给出原长 L ,温度改变量 n ,和热膨胀系数 C,求膨胀后先后中点的高度差. 思 ...
随机推荐
- [Javascript] Implement zip function
1. Use a for loop to traverse the videos and bookmarks array at the same time. For each video and bo ...
- CSS3画腾讯QQ图标 无图片和js参考
css代码: body { font: 12px Tahoma,arial,sans-serif; margin:; padding:; } #mask { left:; opacity: 0.2; ...
- *.pro、*.pri、*.prf、*.prl等四种文件
尽管每次和cmake对比起来,我们总是说 qmake 简单.功能少.但是qmake仍然是一个非常复杂的东西,我想大多人应该和我一样吧: 不是太清楚CONFIG等变量到底如何起作用的 用过的qmak ...
- linux shell执行方式
linux shell执行有两种方式 shell脚本以#!/bin/bash开头,执行shell时先检查首行,在内部以下列方式执行: $/bin/bash script.sh 1. 使用sh执行. $ ...
- Bash String Manipulation Examples – Length, Substring, Find and Replace--reference
In bash shell, when you use a dollar sign followed by a variable name, shell expands the variable wi ...
- L2TP
点击查看详情>> 我的贡献 |退出 L2TP 编辑词条 L2TP是一种工业标准的Internet隧道协议,功能大致和PPTP协议类似,比如同样可以对网络数据流进行加密.不过也有不同之处 ...
- Linux--------------更改yum
1.进入yum配置文件目录 cd /etc/yum.repos.d 2.备份配置文件 mv CentOS-Base.repo CentOS-Base.repo.bak ...
- 破解SQLYog30天试用方法
开始-运行-regedit ,进入注册表,在 \HEYK_CURRENT_USER\Software\{FCE28CE8-D8CE-4637-9BC7-93E4C0D407FA}下的InD保存着SQL ...
- 浅谈C#随机数发生器
我们在做能自动生成试卷的考试系统时,常常需要随机生成一组不重复的题目,在.net Framework中提供了一个专门用来产生随机数的类System.Random. 对于随机数,大家都知道,计算机不 可 ...
- 保留关键字 (Transact-SQL)
https://msdn.microsoft.com/zh-cn/library/ms189822(v=sql.120).aspx Microsoft SQL Server 将保留关键字用于定义.操作 ...