HDU 5476 Explore Track of Point(平面几何)
来源:互联网 发布:明朝为什么会灭亡 知乎 编辑:程序博客网 时间:2024/05/16 08:07
Explore Track of Point
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 263 Accepted Submission(s): 100
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
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
10 1 -1 0 1 0
Sample Output
Case #1: 3.2214
Source
2015 ACM/ICPC Asia Regional Shanghai Online
解题思路:
最后的答案为过点b和点c与ab和ac相切的圆bc这一段劣弧加上三角形的高,根据相似三角形求圆的半径和劣弧所对应的圆心角即可
#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>#include <vector>#include <queue>#include <stack>#include <set>#include <algorithm>using namespace std;const double pi = acos(-1);double ax, ay, bx, by, cx, cy;int main(){ int T, kcase = 1; scanf("%d", &T); while(T--) { scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &cx, &cy); double ab = sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by)); double ac = sqrt((ax - cx) * (ax - cx) + (ay - cy) * (ay - cy)); double bc = sqrt((bx - cx) * (bx - cx) + (by - cy) * (by - cy)); double am = sqrt(ac * ac - 0.5 * bc * 0.5 * bc); double acb = asin(am / ac); double cen = 2 * acb; double r = (0.5 * ac * bc) / am; //cout << r << endl; //cout << cen << endl; double ans = 2 * pi * r * (cen / (2 * pi)); //cout << ans << endl; ans += am; printf("Case #%d: %.4lf\n", kcase++, ans); } return 0;}
0 0
- HDU 5476 Explore Track of Point(平面几何)
- HDU 5476 Explore Track of Point(平面几何)
- hdu 5476 Explore Track of Point(几何)
- HDU 5476 Explore Track of Point
- HDU 5476 Explore Track of Point
- hdu 5476 Explore Track of Point
- hdu5476Explore Track of Point+平面几何
- HDU 5476 Explore Track of Point (2015上海站网赛1009)
- hdu 5476 Explore Track of Point 2015上海网络赛 几何
- HDU 5476 Explore Track of Point(几何)——2015 ACM/ICPC Asia Regional Shanghai Online
- HDU 5476 Explore Track of Point (2015年上海赛区网络赛I题)
- HDU 5476 Explore Track of Point 2015上海网络赛 几何题
- hdoj 5476 Explore Track of Point 【托勒密定理】
- HDU5476 Explore Track of Point 几何题
- HDU5476 Explore Track of Point【计算几何】
- hdu5476 Explore Track of Point(数学)
- HDU 5476 Explore Track of Point 几何题 —— 2015 ACM/ICPC Asia Regional Shanghai Online
- hdu5476 Explore Track of Point 2015上海网络赛
- Java泛型? extends E 和 ? super E
- Java核心技术第3章(4)
- No1 CoreLocation实现地理定位
- c++如何返回数组
- 《构建高性能WEB站点》阅读笔记
- HDU 5476 Explore Track of Point(平面几何)
- 链表常用函数
- 第一次试着在记录些什么。
- iOS导航栏遮盖
- 软件测试的认识
- 给定一个二叉树和任意一个节点,求该该节点的下一层的第一个节点
- Add Two Numbers
- hdu 5475 An easy problem (2015 上海网络赛 H题)
- Github README.md 添加图片