/*hdu6097[二分+解析几何] 2017多校6*/
#include <bits/stdc++.h>
using namespace std;
const double eps=1e-;
struct node{
double x,y;
node(double X=0.0,double Y=0.0):
x(X),y(Y){}
}p,q;
double dist(node a,node b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int T;
double A,B,C,a,b,c,h,R;
bool check(){
a=sqrt(b*b+c*c);
A=c*c;
B=-2.0*a*a*h;
C=a*a*h*h-a*a*b*b+b*b*R*R;
double delta=B*B-4.0*A*C;
//cout<<"delta: "<<delta<<endl;
if(delta>=0.0){//判断复根
double yy1=0.5*(-B+sqrt(delta))/A;
double yy2=0.5*(-B-sqrt(delta))/A;
if(R*R-yy1*yy1>=0.0||R*R-yy2*yy2>=0.0)
return true;
else return false;
}
else return false;
}
void solve(){
double t1,t2;
t1=(p.x+q.x)*0.5;
t2=(p.y+q.y)*0.5;
h=dist(node(t1,t2),node());
c=0.5*dist(p,q);
double l=,r=R-h;
for(int i=;i<;i++){
b=(l+r)*0.5;
if(check()){
r=b;
}
else{
l=b;
}
}
b=(l+r)*0.5;
printf("%.8f\n",2.0*sqrt(b*b+c*c));
/*....*/
}
int main(){
//freopen("1002.in","r",stdin);
//freopen("out.out","w",stdout);
scanf("%d",&T);
while(T--){
scanf("%lf",&R);
scanf("%lf%lf",&p.x,&p.y);
scanf("%lf%lf",&q.x,&q.y);
solve();
}
return ;
}

比赛的时候忘记判断复根了!!  QAQ

hdu6097[二分+解析几何] 2017多校6的更多相关文章

  1. 2017 多校4 Security Check

    2017 多校4 Security Check 题意: 有\(A_i\)和\(B_i\)两个长度为\(n\)的队列过安检,当\(|A_i-B_j|>K\)的时候, \(A_i和B_j\)是可以同 ...

  2. 2017 多校5 hdu 6093 Rikka with Number

    2017 多校5 Rikka with Number(数学 + 数位dp) 题意: 统计\([L,R]\)内 有多少数字 满足在某个\(d(d>=2)\)进制下是\(d\)的全排列的 \(1 & ...

  3. 2017 多校5 Rikka with String

    2017 多校5 Rikka with String(ac自动机+dp) 题意: Yuta has \(n\) \(01\) strings \(s_i\), and he wants to know ...

  4. 2017 多校4 Wavel Sequence

    2017 多校4 Wavel Sequence 题意: Formally, he defines a sequence \(a_1,a_2,...,a_n\) as ''wavel'' if and ...

  5. 2017 多校3 hdu 6061 RXD and functions

    2017 多校3 hdu 6061 RXD and functions(FFT) 题意: 给一个函数\(f(x)=\sum_{i=0}^{n}c_i \cdot x^{i}\) 求\(g(x) = f ...

  6. 2017 多校2 hdu 6053 TrickGCD

    2017 多校2 hdu 6053 TrickGCD 题目: You are given an array \(A\) , and Zhu wants to know there are how ma ...

  7. 2017 多校1 I Curse Myself

    2017 多校2 I Curse Myself(第k小生成树) 题目: 给一张带权无向连通图,该图的任意一条边最多只会经过一个简单环,定义\(V(k)为第k小生成树的权值和\),求出\(\sum_{k ...

  8. hdu6136[模拟+优先队列] 2017多校8

    有点麻烦.. /*hdu6136[模拟+优先队列] 2017多校8*/ #include <bits/stdc++.h> using namespace std; typedef long ...

  9. hdu6134[莫比乌斯反演] 2017多校8

    /*hdu6134[莫比乌斯反演] 2017多校8*/ #include <bits/stdc++.h> using namespace std; typedef long long LL ...

随机推荐

  1. python爬虫之路——初识基本页面构造原理

    通过chrome浏览器的使用简单介绍网页构成 360浏览器使用右键审查元素,Chrome浏览器使用右键检查,都可查看网页代码. 网页代码有两部分:HTML文件和CSS样式.其中有<script& ...

  2. BZOJ 4175: 小G的电话本 SAM+FFT

    4175: 小G的电话本 Time Limit: 45 Sec  Memory Limit: 256 MBSubmit: 195  Solved: 48[Submit][Status][Discuss ...

  3. 《剑指offer》51:数组中的逆序对

    题目描述 在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对.输入一个数组,求出这个数组中的逆序对的总数P.并将P对1000000007取模的结果输出. 即输出P%1000 ...

  4. Android深度探索总结

    Android深度探索前四章总结 通过这几章的学习真实体会到“移植”的概念:为特定设备定制Android的过程,但是移植的过程中开发最多的就是支持各种硬件设备的Linux驱动程序,本章对Android ...

  5. Github使用技巧总结

    <config> PyCharm与GitHub配置使用总结 <readme> 在github的readme添加图片 github readme写法 GitHub上README. ...

  6. ipvsadm启动报错解决方法

    Centos7 yum -y install ipvadm 安装后,启动ipvsadm却报错. Redirecting to /bin/systemctl start ipvsadm.service ...

  7. destoon 给超级管理员系统权限(管理员管理,日志管理等)

    destoon 后台某些系统权限除了网站创始人之外其他超管事没有权限的,现需要给其他超级管理员添加普通管理员的权限. 1.首先  admin/global.func.php  admin_check函 ...

  8. python-for循环与while循环

    while 循环 格式: while 条件 为 True: 代码块 while True: rayn_age = 18 age = input('请输入你的年龄:') age = int(age) i ...

  9. poj3617 best cow line(贪心题)

    Best Cow Line Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 32687   Accepted: 8660 De ...

  10. 水题:UVa133-The Dole Queue

    The Dole Queue Time limit 3000 ms Description In a serious attempt to downsize (reduce) the dole que ...