您的位置:首页 > 其它

LightOJ 1433 - Minimum Arc Distance

2015-10-29 21:03 267 查看
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1433

题意:给你圆心坐标及圆上的两点坐标,求两点距离。

求对应的圆心角度再求距离。水~

代码:

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <string>
#include <string.h>

using namespace std;

int main()
{
double x0, y0, x1, y1, x2, y2;
int t, cases1 = 1;
scanf("%d", &t);
while (t--)
{
scanf("%lf%lf%lf%lf%lf%lf", &x0, &y0, &x1, &y1, &x2, &y2);
printf("Case %d: ", cases1++);
double dis1 = sqrt((x1 - x0)*(x1 - x0) + (y1 - y0)*(y1 - y0));
double dis2 = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

double tmp = asinf(dis2*1.0 / 2 / dis1);

double l = 2.0 *dis1;

double ans = (tmp) * l;
printf("%.6lf\n",ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  lightoj