Explore Track of Point
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 290 Accepted Submission(s): 116
点击打开题目链接
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,
ρ=1−sinθ
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 Γ .
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 (
1≤T≤104
) 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
Source
题意:给出等腰三角形ABC,AB=AC,M为BC中点。P点为三角形内使min{∠MPB+∠APC,∠MPC+∠APB} 最大的点。求P点轨迹长度。
如何确定点P的轨迹,比赛时并没有很好的思路,借助一些软件可以画出轨迹,猜出来,事后参考了一下这篇博客:
http://blog.csdn.net/baileys0530/article/details/48753151,
根据共圆的性质来转移角度,在不知道p的轨迹的情况下,来找到p的轨迹并证明p的轨迹是某一圆弧,还是比较难的,上面的博客中有证明,用到了一些调和点列和调和四边形的知识(托勒密定理也可以证明见点击打开链接,调和点列和调和四边形知识见Q巨博客:http://blog.csdn.net/quailty/article/details/48755567),好久不接触平面几何,都忘记了这些定理,只想说ACM的范围真广~~~若还要继续努力
最后p的轨迹是三角形BIC的外接圆的部分圆弧(I为三角形ABC的内心)在加上高AM,只要求出圆心角及三角形BIC的外接圆半径即可,圆心在AM的延长线上。。。;
代码:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <math.h>
#include <map>
#include <stdlib.h>
#include <algorithm>
#define eps 1e-5
#define inf 0x3f3f3f3f
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1 | 1
#define lc rt<<1
#define rc rt<<1 | 1
#define get2(a) (a)*(a)
#define Pi acos(-1.0)
#define N 100010
typedef long long LL;
using namespace std;
double getdis(double x1,double y1,double x2,double y2)
{
return sqrt(get2(x1-x2)+get2(y1-y2));
}
int main()
{
int t;
scanf("%d",&t);
int cnt=0;
double x1,x2,x3,y1,y2,y3;
while(t--)
{
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
double a=getdis(x1,y1,x2,y2);
double b=getdis(x1,y1,x3,y3);
double c=getdis(x2,y2,x3,y3);
double p=(a+b+c)/2;//三角形ABC的半周长
double s=sqrt(p*(p-a)*(p-b)*(p-c));///三角形ABC的面积
double h=2*s/c;///三角形ABC的高AM的长度
double r=s/p;///三角形ABC内切圆半径
double bm=c/2;
double R=r+(bm*bm-r*r)/(2*r);///三角形BIC的外接圆半径
double hu=2*asin(bm/R);///p带你轨迹的圆弧所对应的圆心角大小
printf("Case #%d: %.4lf\n",++cnt,R*hu+h);
}
return 0;
}