您的位置:首页 > 其它

二分

2016-05-01 10:09 441 查看
https://www.bnuoj.com/v3/contest_show.php?cid=7814#problem/B

#include<iostream>//c++
#include<cmath>//数学公式
#include<cstdlib>//malloc
#include<cstring>
#include<string>
#include<cstdio>//输入输出
#include<algorithm>//快排
#include<queue>//队列
#include<functional>//优先队列
#include<stack>//栈
#include<vector>//容器
#include<map>//地图 if continue
typedef long long ll;
const int N=30;
const double inf=1e-8;
using namespace std;
double x,y,c,l,r,mid;
double get(double z)
{
return 1-c/sqrt(x*x-z*z)-c/sqrt(y*y-z*z);
}
int main()
{
int i,j,m,z,n,k,ans,tmp;
while(~scanf("%lf%lf%lf",&x,&y,&c))
{
l=0;
if(x<y) r=x;
else r=y;
while(r-l>inf)
{
mid=(l+r)/2;
if(get(mid)>0) l=mid;
else r=mid;
}
printf("%.3lf\n",mid);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: