随笔分类 -  计算几何

摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5120题意:求两个圆环的相交面积。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int t; 8 doub... 阅读全文
posted @ 2015-01-19 13:49 null1019 阅读(132) 评论(0) 推荐(0)
摘要:题意:给你两条线段AB,CD;然后给你在AB,CD上的速度P,Q,在其它部分的速度是R,然后求A到D的最短时间。思路:用三分枚举从AB线段上离开的点,然后再用三分枚举在CD的上的点找到最优点,求距离和时间就可以。 1 #include 2 #include 3 #include 4 #incl... 阅读全文
posted @ 2014-11-26 19:26 null1019 阅读(171) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2398题意:一个矩形盒子,在里面用多个板子把这个矩形盒子分成多部分,然后给你多个点,判断这些点在每个盒子有多少个点。思路:根据给出板子的坐标,对这些板子的坐标排序,然后记录每一个被分出的小矩形的四个点,输入每一个点的时候判断在哪一个小矩形里面,用... 阅读全文
posted @ 2014-11-24 20:39 null1019 阅读(205) 评论(0) 推荐(0)
摘要:http://acm.timus.ru/problem.aspx?space=1&num=1246 1 #include 2 #include 3 #include 4 #define maxn 200010 5 using namespace std; 6 7 struct node 8 { 9 double x,y;10 }p[maxn];11 12 double cross(node a,node b,node c)13 {14 return (c.x-a.x)*(b.y-a.y)-(c.y-a.y)*(b.x-a.x);15 }16 17 int main()1... 阅读全文
posted @ 2014-03-25 19:25 null1019 阅读(224) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const double eps=1e-8; 7 8 int main() 9 {10 double a,b,c,d;11 scanf("%lf%lf%lf%lf",&a,&b,&c,&d);12 a*=1000.0; b*=1000.0; c*=1000.0; d*=1000.0;13 if(fabs(c*d-a*b)<eps)14 {15 printf("Impossible.\n&qu 阅读全文
posted @ 2014-03-24 19:43 null1019 阅读(174) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #define maxn 20000 6 using namespace std; 7 const double eps=1e-8; 8 9 inline double sqr(double x)10 {11 return x*x;12 }13 inline int dcmp(double x)14 {15 if(fabs(x)eps)43 {44 return false;45 }46 }47 retu... 阅读全文
posted @ 2014-03-22 23:21 null1019 阅读(135) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #define maxn 200 5 using namespace std; 6 7 double x[maxn],y[maxn],r[maxn]; 8 9 double sqr(double x)10 {11 return x*x;12 }13 14 int main()15 {16 int t;17 scanf("%d",&t);18 for(int i=0; i<t; i++)19 {20 scanf("%lf%lf%lf",&x[i],&y[i] 阅读全文
posted @ 2014-03-22 21:19 null1019 阅读(129) 评论(0) 推荐(0)
摘要:http://acm.timus.ru/problem.aspx?space=1&num=1052 1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct node 7 { 8 double x,y; 9 }p[500];10 11 double cross(node a,node b,node c)12 {13 return ((c.x-a.x)*(b.y-a.y)-(c.y-a.y)*(b.x-a.x));14 }15 int main()16 {17 int n;18 s... 阅读全文
posted @ 2014-03-19 18:34 null1019 阅读(175) 评论(0) 推荐(0)
摘要:http://acm.timus.ru/problem.aspx?space=1&num=1348 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const double eps=1e-10; 7 8 double dcmp(double x){ 9 if(fabs(x)0) return dis(p.x,p.y,b.x,b.y);43 else return (fabs(cross(p1,p2))/dis(a.x,a.y,b.x,b.y));44 }45 46 int mai... 阅读全文
posted @ 2014-03-18 19:39 null1019 阅读(229) 评论(0) 推荐(0)
摘要:极角排序 1 #include 2 #include 3 #include 4 #include 5 #define maxn 30000 6 using namespace std; 7 8 struct point 9 {10 double x,y;11 int num;12 }p[maxn];13 point pp;14 double cross(const point &a,const point &b,const point &c)15 {16 return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);17 }18... 阅读全文
posted @ 2014-03-17 21:28 null1019 阅读(300) 评论(0) 推荐(0)
摘要:这道题真的很无聊,就是找一个圆,至少有一个点在这个圆上,其他点不能在圆外,半径不定; 1 #include 2 #include 3 #include 4 #include 5 #define maxn 3000 6 using namespace std; 7 8 struct node 9 {10 int x,y;11 }p[300];12 double sqr(double x)13 {14 return x*x;15 }16 bool vis[maxn];17 double dis(int x1,int y1,int x2,int y2)18 {19 ... 阅读全文
posted @ 2014-03-17 20:15 null1019 阅读(180) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const double eps=1e-9; 7 8 double getarea(double a,double b,double c) 9 {10 double p=(a+b+c)/2.0;11 return (c*c/4+sqrt(p*(p-a)*(p-b)*(p-c)));12 }13 14 int main()15 {16 double x,y;17 scanf("%lf%lf",&x,&y);18 ... 阅读全文
posted @ 2014-03-17 19:45 null1019 阅读(241) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #define maxn 1000 6 using namespace std; 7 8 int main() 9 {10 int f,n,t,f1;11 double size,size1;12 scanf("%d%lf",&f,&size);13 scanf("%d",&n);14 t=n;15 int ans=0;16 while(t--)17 {18 scanf("%d%lf",&f1,&size 阅读全文
posted @ 2014-03-17 19:11 null1019 阅读(238) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const double pi=acos(-1.0); 7 8 int main() 9 {10 double a,r;11 scanf("%lf%lf",&a,&r);12 if(a>=r*2) printf("%.3lf\n",pi*r*r);//绳子形成的圆在正方形内13 else if(r>=sqrt(2)*a/2) printf("%.3lf\n",a*a);/ 阅读全文
posted @ 2014-03-17 15:22 null1019 阅读(183) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #define maxn 2000 6 using namespace std; 7 const double pi=acos(-1.0); 8 9 10 int main()11 {12 double v,a,k;13 scanf("%lf%lf%lf",&v,&a,&k);14 double ans=0;15 a=a*pi/180;16 while(1)17 {18 if(v<0.01) break;19 a... 阅读全文
posted @ 2014-03-17 13:12 null1019 阅读(201) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #define maxn 2000 6 using namespace std; 7 const double pi=acos(-1.0); 8 9 double sqr(double x)10 {11 return x*x;12 }13 struct node14 {15 double x,y;16 }p[maxn];17 18 double dis(node a,node b)19 {20 return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y)... 阅读全文
posted @ 2014-03-17 12:58 null1019 阅读(178) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3227 1 #include 2 #include 3 #include 4 #include 5 #define maxn 2000 6 using namespace std; 7 8 int n,h; 9 const double eps=1e-8;10 int cmp(double x)11 {12 if(fabs(x)0) return 1;14 return -1;15 }16 struct point17 {18 double x,y;19 point() {}20 point... 阅读全文
posted @ 2014-02-28 20:11 null1019 阅读(227) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3130 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1000000 6 using namespace std; 7 8 const double eps=(1e-8); 9 struct point10 {11 double x,y;12 };13 double a,b,c;14 int n,cutt=0,m;15 point p1[maxn];16 point p2[maxn];17 point p3[maxn];18 19 void get(p... 阅读全文
posted @ 2014-02-24 14:37 null1019 阅读(233) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3335 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1000000 6 using namespace std; 7 8 const double eps=(1e-8); 9 struct point10 {11 double x,y;12 };13 double a,b,c;14 int n,cutt=0,m;15 point p1[maxn];16 point p2[maxn];17 point p3[maxn];18 19 void get(p... 阅读全文
posted @ 2014-02-24 14:30 null1019 阅读(251) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1819 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const double eps=1e-8; 9 struct point10 {11 double x;12 double y,r;13 }pp[2000];14 bool flag[2000];15 int stack1[2000],n;16 17 int main()18 {19 while(scanf("%d",&n)!=EOF... 阅读全文
posted @ 2014-02-24 09:21 null1019 阅读(221) 评论(0) 推荐(0)