POJ Expanding Rods
题目大意
给定L,n,C,L为红色线段,L(1+n*C)为绿色弧,求两者中点的距离
二分圆心角度数,接下来就是几何的能力了
根据正弦定理,可得:
Lsinθ=rsin(90°−θ)
则弧长:
a=πr⋅θ180
将a与nL作比较来二分
精度满天飞 QWQ
代码如下:
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
double pi=3.1415926535897932384626433832795,eps=0.000000001;
double L,C,n,nL;
using namespace std;
double work(double mid)
{
double a1=sin(2*pi*mid/360),a2=sin(2*pi*(90-mid/2)/360);
double r=L/a1*a2;
return 2*r*pi*mid/360;
}
int main()
{
while(scanf("%lf%lf%lf",&L,&n,&C))
{
if(L==-1&&n==-1&&C==-1)return 0;
nL=(1+n*C)*L;
if(nL==L){printf("0.000\n");continue;}
double l=0,r=180,mid;
while(r-l>eps)
{
mid=(l+r)/2;
if(work(mid)<nL)l=mid;
else r=mid;
}
printf("%.3lf\n",L/sin(2*pi*l/360)*sin(2*pi*(90-mid/2)/360)-sqrt(pow(L/sin(2*pi*l/360)*sin(2*pi*(90-mid/2)/360),2)-pow(L/2,2)));
}
}
POJ 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: 1 ...
- poj 1905 Expanding Rods(木杆的膨胀)【数学计算+二分枚举】
...
- POJ 1905:Expanding Rods 求函数的二分
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 13780 Accepted: 3563 D ...
- POJ 1905 Expanding Rods(二分)
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 20224 Accepted: 5412 Descr ...
- Expanding Rods(二分POJ1905)
Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 13688 Accepted: 3527 D ...
- UVA 10668 - Expanding Rods(数学+二分)
UVA 10668 - Expanding Rods 题目链接 题意:给定一个铁棒,如图中加热会变成一段圆弧,长度为L′=(1+nc)l,问这时和原来位置的高度之差 思路:画一下图能够非常easy推出 ...
- UVA 10668 Expanding Rods
Problem A: Expanding Rods When a thin rod of length L is heated n degrees, it expands to a new lengt ...
- 1137 - Expanding Rods
1137 - Expanding Rods PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 M ...
随机推荐
- 2019-8-31-C#-匹配可空变量
title author date CreateTime categories C# 匹配可空变量 lindexi 2019-08-31 16:55:58 +0800 2019-06-01 08:40 ...
- js 快速取整
我们要将23.8转化成整数 有哪些方法呢 比如 Math.floor( ) 对数进行向下取整 它返回的是小于或等于函数参数,并且与之最接近的整数 Math.floor(5.1) 返回值 //5 M ...
- OpenWrt Kernel Module Creation Howto
OpenWrt Kernel Module Creation Howto About OpenWrt Kernel Module Compilation You are planning to com ...
- LeetCode111_求二叉树最小深度(二叉树问题)
题目: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the s ...
- java日志学习(持续更新)
1.Java实现日志 java日志体系大体可以分为三个部分:日志门面接口.桥接器.日志框架具体实现.原生日志实现(http://www.importnew.com/16331.html) Java日志 ...
- 【题解】Leyni,罗莉和队列(树状数组)
[题解]Leyni,罗莉和队列(树状数组) HRBUST - 1356 将整个序列reverse一下,现在就变成了从高到低的排队.题目就变成了,定位一个妹子,问这个妹子前面的比这个妹子小的妹子中,下标 ...
- shopnc 二次开发问题(一)
1.关于shopnc商品详情页面多规格抢购,价格显示都是显示的抢购价格问题 路径: data/model/groupbuy.model.php 方法:getGroupbuyInfoByGoodsCom ...
- [NoSQL] 从模型关系看 Mongodb 的选择理由
往期:Mongodb攻略 回顾 Mongodb 与关系型数据库的对应关系: MySQL MongoDB database(数据库) database(数据库) table(表) collectio ...
- Linux下安装oracle提示INS-20802 Oracle Net Configuration Assistant
安装oracle的时候,在最后install过程中,突然弹出INS-20802 :Oracle Net Configuration Assistant 错误. 查了一些资料,也尝试了很多,但是最终尝试 ...
- spring boot的application配置文件
上次我们已经对这个文件见过面了,并且对他进行了一些简单的配置.它有两种配置方式,一个是application.properties,一个是application.yml文件,需要记住,当两个文件都 ...