HDU 5476 Explore Track of Point (2015年上海赛区网络赛I题)
来源:互联网 发布:淘宝店刷销量方法 编辑:程序博客网 时间:2024/05/16 14:11
1.题目描述:点击打开链接
2.解题思路:本题需要事先求出点P的轨迹形状,容易发现,题目要求找的是2角相加恰好是180度时候点的轨迹。比赛时候猜出来样例是由sqrt(2)*PI/2+1得到的,然而没有想到这个圆长什么样子==,差点就猜到圆的半径是sqrt(2),圆心角是90度了。那只有一种情况就是这个圆和等腰三角形的两条边是旁切的。至于证明,过程比较复杂,因此在此略去。大概如下:
3.代码:
#include<iostream>#include<algorithm>#include<cassert>#include<string>#include<sstream>#include<set>#include<bitset>#include<vector>#include<stack>#include<map>#include<queue>#include<deque>#include<cstdlib>#include<cstdio>#include<cstring>#include<cmath>#include<ctime>#include<cctype>#include<list>#include<complex>#include<functional>#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;#define me(s) memset(s,0,sizeof(s))#define rep(i,n) for(int i=0;i<(n);i++)typedef long long ll;typedef unsigned int uint;typedef unsigned long long ull;typedef pair <int,int> P;#define me(s) memset(s,0,sizeof(s))#define rep(i,n) for(int i=0;i<(n);i++)typedef long long ll;typedef unsigned int uint;typedef unsigned long long ull;typedef pair<int,int> P;struct Point{ double x,y; Point(){} Point(double x,double y):x(x),y(y){} void read() { scanf("%lf%lf",&x,&y); }};typedef Point Vector;Vector operator+(Vector a,Vector b){return Vector(a.x+b.x,a.y+b.y);}Vector operator-(Vector a,Vector b){return Vector(a.x-b.x,a.y-b.y);}Vector operator*(Vector a,double p){return Vector(a.x*p,a.y*p);}double Dot(Vector a,Vector b){return a.x*b.x+a.y*b.y;}double Cross(Vector a,Vector b){return a.x*b.y-a.y*b.x;}double Length(Vector a){return sqrt(Dot(a,a));}Point a,b,c;int main(){ int T; int rnd=0; scanf("%d",&T); while(T--) { a.read(); b.read(); c.read(); Vector v1=c-b; Vector v2=a-b; double h=fabs(Cross(v1,v2))/Length(v1); double L1=Length(v2),L2=Length(v1); double R=L1*L2/(2*h); double e=acos(1-(L2*L2/(2*R*R))); double ans=e*R+h; printf("Case #%d: %.4lf\n",++rnd,ans); }}
0 0
- HDU 5476 Explore Track of Point (2015年上海赛区网络赛I题)
- HDU 5476 Explore Track of Point 2015上海网络赛 几何题
- hdu 5476 Explore Track of Point 2015上海网络赛 几何
- hdu5476 Explore Track of Point 2015上海网络赛
- HDU 5476 Explore Track of Point (2015上海站网赛1009)
- 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
- HDU 5476 Explore Track of Point 几何题 —— 2015 ACM/ICPC Asia Regional Shanghai Online
- HDU 5476 Explore Track of Point(几何)——2015 ACM/ICPC Asia Regional Shanghai Online
- HDU5476 Explore Track of Point 几何题
- hdu5476 Explore Track of Point(数学)
- hdoj 5476 Explore Track of Point 【托勒密定理】
- HDU5476 Explore Track of Point【计算几何】
- HDU 5478 Can you find it (2015年上海赛区网络赛K题)
- 混淆器ProGuard
- ListView数据重复现象,以及解决办法
- Leetcode81: Search Insert Position
- iOS中的堆和栈
- ionic项目中使用cordova插件支付宝支付
- HDU 5476 Explore Track of Point (2015年上海赛区网络赛I题)
- jquery.ajax 的例子
- 编译生成.NET DLL并调用
- android学习:在ListView显示对象信息、侦听列表事件
- ListCtrl虚拟列表---加载大数据
- 三层标签pop
- DevExpress v15.1.5发布[附下载]
- C#学习之事件
- nginx 配置 ssl 模块支持 https