hdu5476Explore Track of Point+平面几何

原创 2016年08月31日 16:18:48

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 Γ.

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
2015 ACM/ICPC Asia Regional Shanghai Online
盗了一张图。
这里写图片描述
答案就是劣弧BC+AM
由相似的r.

#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<set>
#define pi acos(-1.0)
#define EPS 1e-6    //log(x)
#define e exp(1.0); //2.718281828
#define mod 1000000007
#define INF 0x7fffffff
#define inf 0x3f3f3f3f
typedef long long LL;
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;
    scanf("%d",&t);
    double ax,ay,bx,by,cx,cy;
    for(int cas=1;cas<=t;cas++){
        scanf("%lf %lf %lf %lf %lf %lf",&ax,&ay,&bx,&by,&cx,&cy);
        double mx=(bx+cx)/2,my=(by+cy)/2;
        double am=dis(ax,ay,mx,my);
        double bm=dis(bx,by,mx,my);
        double ab=dis(ax,ay,bx,by);
        double r=ab*bm/am;
        //cout<<r<<" "<<bm<<endl;
        //cout<<acos(bm/r)<<endl;
        double ans=(pi/2-acos(bm/r))*2*r;
        printf("Case #%d: %.4f\n",cas,ans+am);
    }

    return 0;
}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         I have a dream!A AC deram!!
 orz orz orz orz orz orz orz orz orz orz orz
 orz orz orz orz orz orz orz orz orz orz orz
 orz orz orz orz orz orz orz orz orz orz orz

*/

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

HDU 5476 Explore Track of Point(平面几何)

Explore Track of Point Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/...

HDU 5476 Explore Track of Point (2015上海站网赛1009)

这是一道纯平面几何题,高中时候最喜欢的数学竞赛的一块知识!!! 硬要说什么难度的话,初中数学竞赛的知识点,入门级平面几何吧。。。(而现在的我太过愚蠢。。。) 图中的圆是,过B,C点并与三角形ABC...

HDU 5476 Explore Track of Point 2015上海网络赛 几何题

发霉的题解….(自己已经不会证)题目见HDU 5476给出等腰三角形ABC,AB=AC,M为BC中点。P点为三角形内使min{∠MPB+∠APC,∠MPC+∠APB} 最大的点。求P点轨迹。 则容易...

hdu 5476 Explore Track of Point 2015上海网络赛 几何

2015上海网络赛第四题

HDU 5476 Explore Track of Point (2015年上海赛区网络赛I题)

1.题目描述:点击打开链接 2.解题思路:本题需要事先求出点P的轨迹形状,容易发现,题目要求找的是2角相加恰好是180度时候点的轨迹。比赛时候猜出来样例是由sqrt(2)*PI/2+1得到的,然而没有...

Trading point to explore - legendary Jiuge

I believe industry, and after this is extremely simple, My partner and i calm down after a period wi...

Keeping Track of Elapsed Time in Python

refer to: http://www.techarticles.zeromu.net/programming/keeping-track-of-elapsed-time-in-python/Thi...

GPS北斗软件接收机/跟踪捕获定位输出/A GPS software receiver【All of acq track nav filter and other NMEA】*嵌入式GPS导航代码*

如果贵公司您对GPS全工程基于硬件的代码和解决方案感兴趣,或者对软件接收机感兴趣也可以联系我 功能:从射频 中频 基带信号 到 捕获 跟踪 选星定位 滤波 到最后导航 输出以标准的NMEA...

Keep Track of a Programs Usage

HDU6055-Regular polygon 简单平面几何

传送门 题意: 给n个点,问能组成多少个正多边形 思路: 1、求正多边形即求正方形 2、枚举每条边,通过枚举的边,查询以当前边为对角线的正方形,另外两个点是否...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)