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 ...
随机推荐
- vue-learning:29 - component - 组件三大API之三:slot
组件三大API之三: slot <slot>标签 v-slot指令 普通插槽 有默认值的插槽 具名插槽 作用域插槽 v-slot是Vue 2.6.0引入的一个新语法指令,目的是统一之前sl ...
- 彻底搞懂HTML5文件上传操作需要的相关资料
https://developer.mozilla.org/zh-CN/docs/Web/GuideMDN Web Guide https://developer.mozilla.org/zh-CN/ ...
- 一些实战中总结的 javascript 开发经验
Javascript 的很多扩展的特性是的它变得更加的犀利, 同时也给予程序员机会创建更漂亮并且更让用户喜欢的网站. 尽管很多的开发人员都乐于颂扬 javascript,但是仍旧有人看到它的阴暗面. ...
- [Python之路] 内存管理&垃圾回收
一.python源码 1.准备源码 下载Python源码:https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz 解压得到文件夹: 我们主要关 ...
- AI炼丹 - 深度学习必备库 numpy
目录 深度学习必备库 - Numpy 1. 基础数据结构ndarray数组 1.1 为什么引入ndarray数组 1.2 如何创建ndarray数组 1.3 ndarray 数组的基本运算 1.4 n ...
- poj3471 - 倍增+LCA+树上差分
题意:一张n节点连通无向图,n-1条树边,m条非树边.若通过先删一条树边,再删一条非树边想操作 将此图划分为不连通的两部分,问有多少种方案. 利用LCA整好区间覆盖,dfs用来求前缀和 需要注意的是, ...
- 网络知识_01:ISO七层模型
一 IOS七层模型 1.1OSI的概念 Open System Interconnect开放系统互连参考模型,是由ISO(国际标准化组织)定义的.它是个灵活的.稳健的和可互操作的模型. 1.2OSI模 ...
- Zeus,一个可以快速使用微服务组件
去年(上周)一直准备着做一个分布式微服务的组件,可以让使用者用最简单的方式引入,只需要使用简单的注解就能够使用. 用一点一点的空闲时间终于堆出来一个暂时可用的zeus-1.0版本. Zeus,意为宙斯 ...
- MVC 之集合类转化为DataTable
private static DataTable ToDataTableTow(IList list) { DataTable result = new DataTable(); if (list.C ...
- VC++取MD5算法记录下以后用得到(转)
这个是网上扒下来的 作者已经无法知道是谁了 MD5.h #ifndef MD5_H #define MD5_H #include <string> #include <fstream ...