hdu5476 Explore Track of Point(数学)

思路:一道纯平面几何题....显然AM是成立的,然后猜测剩下的是与AB,AC相切的圆的劣弧...就做完了...


#include<bits/stdc++.h>
using namespace std;
double dis(double x1,double y1,double x2,double y2)
{
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main()
{
    int T,cas=1;
    scanf("%d",&T);
    while(T--)
    {
        printf("Case #%d: ",cas++);
        double ax,ay,bx,by,cx,cy;
        scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&cx,&cy);
        double mx = (cx+bx)/2;
        double my = (cy+by)/2;
        double am = dis(ax,ay,mx,my);
        double r = dis(bx,by,mx,my)/dis(ax,ay,mx,my)*dis(ax,ay,bx,by);
        double ang = atan(dis(ax,ay,bx,by)/r);
        printf("%.4f\n",am+2*ang*r);  
    }
}


Problem Description
In Geometry, the problem of track is very interesting. Because in some cases, the track of point may be beautiful curve. For example, in polar Coordinate system, ρ=cos3θ  is like rose,  ρ=1sinθ  is a Cardioid, and so on. Today, there is a simple problem about it which you need to solve.

Give you a triangle  ΔABC  and AB = AC. M is the midpoint of BC. Point P is in  ΔABC  and makes  min{MPB+APC,MPC+APB}  maximum. The track of P is  Γ . Would you mind calculating the length of  Γ ?

Given the coordinate of A, B, C, please output the length of  Γ .
 

Input
There are T ( 1T104 ) test cases. For each case, one line includes six integers the coordinate of A, B, C in order. It is guaranteed that AB = AC and three points are not collinear. All coordinates do not exceed  104  by absolute value.
 

Output
For each case, first please output "Case #k: ", k is the number of test case. See sample output for more detail. Then, please output the length of  Γ  with exactly 4 digits after the decimal point.
 

Sample Input
  
  
1 0 1 -1 0 1 0
 

Sample Output
  
  
Case #1: 3.2214
 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值