LightOJ 1433-Minimum Arc Distance【几何】
来源:互联网 发布:台灯哪个牌子好 知乎 编辑:程序博客网 时间:2024/05/18 02:06
You all probably know how to calculate the distance between two points in two dimensional cartesian plane. But in this problem you have to find the minimum arc distance between two points and they are on a circle centered at another point.
You will be given the co-ordinates of the points A and B and co-ordinate of the center O. You just have to calculate the minimum arc distance between A and B. In the picture, you have to calculate the length of arc ACB. You can assume that A and B will always be on the circle centered at O.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.
Each case starts with a line containing six integers Ox, Oy, Ax, Ay, Bx, By where (Ox, Oy) indicates the co-ordinate of O, (Ax, Ay) denote the co-ordinate of A and (Bx, By) denote the co-ordinate of B. All the integers will lie in the range [1, 10000].
Output
For each case, print the case number and the minimum arc distance. Errors less than 10-3 will be ignored.
Sample Input
Output for Sample Input
5
5711 3044 477 2186 3257 7746
3233 31 3336 1489 1775 134
453 4480 1137 6678 2395 5716
8757 2995 4807 8660 2294 5429
4439 4272 1366 8741 6820 9145
Case 1: 6641.81699183
Case 2: 2295.92880
Case 3: 1616.690325
Case 4: 4155.64159340
Case 5: 5732.01250253
#include<stdio.h>#include<string.h>#include<cmath>#include<algorithm>using namespace std;int main(){int t,tt=0;scanf("%d",&t);while(t--){double ox,oy,x1,y1,x2,y2;scanf("%lf%lf%lf%lf%lf%lf",&ox,&oy,&x1,&y1,&x2,&y2);printf("Case %d: ",++tt);double l1,l2;l1=sqrt((ox-x1)*(ox-x1)+(oy-y1)*(oy-y1));l2=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));l2=(double)l2/2;double a=asin(l2/l1);a=a*2.0;printf("%.10lf\n",a*l1);}return 0;}
- LightOJ 1433-Minimum Arc Distance【几何】
- LightOJ 1433 Minimum Arc Distance
- LightOJ 1433 - Minimum Arc Distance
- LightOJ - 1433 Minimum Arc Distance (数学几何)求圆上两点间的弧长
- Light oj 1433 - Minimum Arc Distance【计算几何(坑精度!)】
- Lightoj1433——Minimum Arc Distance (求弧长)
- Closest Distance LightOJ
- 自然语言处理-Minimum edit distance
- Minimum distance of three points
- UVA 11796 Dog Distance 几何
- UVA11796 Dog Distance 计算几何
- Dog Distance - UVa 11796 几何
- UVa11796 - Dog Distance(二维几何)
- LightOJ 1072 Calm Down 几何
- lightoj 1146 - Closest Distance(三分)
- Minimum edit distance(levenshtein distance)(最小编辑距离)初探
- 动态规划 求解 Minimum Edit Distance
- 动态规划 求解 Minimum Edit Distance
- android 判断程序是首次(第一次)进入
- activiti 个人任务指定办理人三种方式(十)
- AJax的使用json数据的传输回调函数
- css预处理器--less
- [python]CategoryTree的设计与实现
- LightOJ 1433-Minimum Arc Distance【几何】
- 基于分布式架构的大数据商业建模
- detection/region/object proposal 方法综述文章
- HTML/JSP实现跳转到页面指定位置
- python学习第二站--列表list、tuple
- JS刷新页面方法
- android图表——MPAndroidchart
- GDOI2016总结
- [从头学声学] 第203节 复合的声波(2)