0
点赞
收藏
分享

微信扫一扫

HDU5476 Explore Track of Point【计算几何】

小a草 2022-07-27 阅读 36


题目链接:

​​http://acm.hdu.edu.cn/showproblem.php?pid=5476​​


题目大意:

给你一个等腰三角形ABC,AB = AC,M为三角形底边 BC 的中点。P 点为三角形内使

min {∠MPB+∠APC,∠MPC+∠APB} 最大的点。求 P 点轨迹长度。


AC代码:


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

int main()
{
double ax,ay,bx,by,cx,cy;
int T,kase = 0;
scanf("%d",&T);
while(T--)
{
scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&cx,&cy);
double t1 = (ax-bx)*(ax-bx)+(ay-by)*(ay-by);
double t2 = (bx-cx)*(bx-cx)+(by-cy)*(by-cy);
double ab = sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
double bc = sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy));
double h = sqrt(t1-t2/4);
double ang = acos(bc/ab/2.0);
double d = bc / sin(ang);
double ans = d*ang + h;
printf("Case #%d: %.4lf\n",++kase,ans);
}

return 0;
}



举报

相关推荐

0 条评论