HDU 6097 Mindis【几何】
来源:互联网 发布:淘宝退款能申请几次 编辑:程序博客网 时间:2024/06/01 10:12
Mindis
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2800 Accepted Submission(s): 563
Special Judge
Problem Description
The center coordinate of the circle C is O, the coordinate of O is (0,0) , and the radius is r.
P and Q are two points not outside the circle, and PO = QO.
You need to find a point D on the circle, which makesPD+QD minimum.
Output minimum distance sum.
P and Q are two points not outside the circle, and PO = QO.
You need to find a point D on the circle, which makes
Output minimum distance sum.
Input
The first line of the input gives the number of test cases T; T test cases follow.
Each case begins with one line with r : the radius of the circle C.
Next two line each line contains two integers x , y denotes the coordinate of P and Q.
Limits
T≤500000
−100≤x,y≤100
1≤r≤100
Each case begins with one line with r : the radius of the circle C.
Next two line each line contains two integers x , y denotes the coordinate of P and Q.
Limits
Output
For each case output one line denotes the answer.
The answer will be checked correct if its absolute or relative error doesn't exceed10−6 .
Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if|a−b|max(1,b)≤10−6 .
The answer will be checked correct if its absolute or relative error doesn't exceed
Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
Sample Input
444 00 440 33 040 22 040 11 0
Sample Output
5.65685435.65685435.89450306.7359174
Source
2017 Multi-University Training Contest - Team 6
思路:作P、Q的反演点,即
#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<stack>#include<vector>#include<map>#include<set>#include<algorithm>using namespace std;#define ll long long#define ms(a,b) memset(a,b,sizeof(a))#define maxn 510const int M=1e3+10;const int MM=2e3+10;const int inf=0x3f3f3f3f;const int mod=1e9+7;;const double eps=1e-8;struct node{ double x,y;}p[10];int dcmp(double x){ if(fabs(x)<=eps)return 0; return x<0?-1:1;}double cal(double x1,double y1,double x2,double y2){ return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}int main(){ int t; scanf("%d",&t); while(t--){ double r; scanf("%lf",&r); scanf("%lf%lf",&p[1].x,&p[1].y); scanf("%lf%lf",&p[2].x,&p[2].y); double op=cal(p[1].x,p[1].y,0,0); if(dcmp(op)==0){ printf("%.7f\n",2*r); continue; } double k=r*r/op/op; p[3].x=p[1].x*k;p[3].y=p[1].y*k; p[4].x=p[2].x*k;p[4].y=p[2].y*k; p[5].x=(p[3].x+p[4].x)/2; p[5].y=(p[4].y+p[3].y)/2; double od=cal(p[5].x,p[5].y,0,0); if(od<=r){ printf("%.7f\n",cal(p[3].x,p[3].y,p[4].x,p[4].y)*op/r); } else { p[6].x=p[5].x*r/od;p[6].y=p[5].y*r/od; printf("%.7f\n",2*cal(p[6].x,p[6].y,p[1].x,p[1].y)); } } return 0;}
Mindis
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2800 Accepted Submission(s): 563
Special Judge
Problem Description
The center coordinate of the circle C is O, the coordinate of O is (0,0) , and the radius is r.
P and Q are two points not outside the circle, and PO = QO.
You need to find a point D on the circle, which makesPD+QD minimum.
Output minimum distance sum.
P and Q are two points not outside the circle, and PO = QO.
You need to find a point D on the circle, which makes
Output minimum distance sum.
Input
The first line of the input gives the number of test cases T; T test cases follow.
Each case begins with one line with r : the radius of the circle C.
Next two line each line contains two integers x , y denotes the coordinate of P and Q.
Limits
T≤500000
−100≤x,y≤100
1≤r≤100
Each case begins with one line with r : the radius of the circle C.
Next two line each line contains two integers x , y denotes the coordinate of P and Q.
Limits
Output
For each case output one line denotes the answer.
The answer will be checked correct if its absolute or relative error doesn't exceed10−6 .
Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if|a−b|max(1,b)≤10−6 .
The answer will be checked correct if its absolute or relative error doesn't exceed
Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
Sample Input
444 00 440 33 040 22 040 11 0
Sample Output
5.65685435.65685435.89450306.7359174
Source
2017 Multi-University Training Contest - Team 6
阅读全文
0 0
- hdu 6097 Mindis(几何)
- HDU 6097 Mindis【几何】
- HDU 6097 Mindis 几何
- HDU 6097 Mindis(几何)
- hdu 6097 Mindis(几何反演)
- HDU 6097 Mindis【计算几何】
- 多校6 HDU-6097 Mindis 几何数学
- HDU 6097 Mindis(计算几何)
- HDU 6097 Mindis【计算几何+反演点】
- HDU 6097 Mindis(计算几何)
- (2017多校6)1002/hdu-6097 Mindis(计算几何)
- hud 6097 Mindis(几何)
- hdu 6097 Mindis
- hdu 6097 Mindis (高中数学)
- Mindis HDU-6097
- HDU 6097 Mindis
- HDU 6097 Mindis(反演)
- HDU 6097 Mindis
- UVA10288Coupons
- Linux网络
- MySql存储引擎
- USACO Section 1.3 Barn Repair
- 数据结构实验之排序二:交换排序
- HDU 6097 Mindis【几何】
- Android进程保活招式大全
- Laravel : Syntax error or access violation: 1055 Error
- zookeeper的单机和伪集群myid中的数字是唯一标识
- eclipse开发Android新建工程文件中每个文件代表的含义
- JAVA系统之间通信方式总结
- 纯虚函数
- hdu 1059 完全背包
- 难用的vertical-align