首页 技术 正文
技术 2022年11月7日
0 收藏 476 点赞 665 浏览 1767 个字

题面

传送门

分析

如图:已知AB=L,弧AB=L(1+nC)” role=”presentation” style=”position: relative;”>AB=L,弧AB=L(1+nC)AB=L,弧AB=L(1+nC),M为AB中点,N为圆上一点,且ON垂直于AB于M,求MN

设半径为R” role=”presentation” style=”position: relative;”>RR,∠AOM=θ” role=”presentation” style=”position: relative;”>∠AOM=θ∠AOM=θ(弧度),MN=x” role=”presentation” style=”position: relative;”>MN=xMN=x

则可列出方程组

{2Rθ=L(1+nc)(1)Rsin⁡θ=L2(2)x=R(1−cos⁡θ)(3)” role=”presentation” style=”position: relative;”>⎧⎩⎨⎪⎪⎪⎪2Rθ=L(1+nc)(1)Rsinθ=L2(2)x=R(1−cosθ)(3){2Rθ=L(1+nc)(1)Rsin⁡θ=L2(2)x=R(1−cos⁡θ)(3)

若求出θ” role=”presentation” style=”position: relative;”>θθ便可以求出x,所以我们从 θ” role=”presentation” style=”position: relative;”>θθ入手,尝试解上面的方程组

由(1)(2)式得 θsin⁡θ=1+nC” role=”presentation” style=”position: relative;”>θsinθ=1+nCθsin⁡θ=1+nC

本人数学不好,求不出上面的方程的解析解(如果有解析解可以在评论中指出)

于是采用二分的方法来近似求根

显然0&lt;θ≤π2″ role=”presentation” style=”position: relative;”>0<θ≤π20<θ≤π2

由图知θ” role=”presentation” style=”position: relative;”>θθ越大,1+nC越大” role=”presentation” style=”position: relative;”>1+nC越大1+nC越大

我们二分θ” role=”presentation” style=”position: relative;”>θθ,设二分中点为mid,端点为[L,R]并计算midsin⁡mid” role=”presentation” style=”position: relative;”>midsinmidmidsin⁡mid,若midsin⁡mid&gt;1+nC” role=”presentation” style=”position: relative;”>midsinmid>1+nCmidsin⁡mid>1+nC,则寻找更小的,R=mid.否则寻找更大的,L=mid

还有几个细节:

1.π” role=”presentation” style=”position: relative;”>ππ一定要很精确,否则会WA

2.设定的二分误差要尽量小

代码

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define eps 1e-11
#define pi 3.141592653589793
using namespace std;
double L,n,C,theta,x;
int main(){
while(scanf("%lf %lf %lf",&L,&n,&C)!=EOF){
if(L==n&&n==C&&C==-1) break;
if(n*C==0){
printf("0.000\n");
continue;
}
double l=eps,r=pi/2;//用弧度表示角
while(fabs(l-r)>eps){
double mid=(l+r)/2;
double hu=mid/sin(mid);
if(hu>1+n*C) r=mid;
else l=mid;
}
theta=l;
double R=L/(2*sin(theta));
printf("%.3f\n",R*(1-cos(theta)));
}
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,992
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,506
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,349
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,134
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,766
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,844