上一页 1 2 3 4 5 6 7 8 9 ··· 14 下一页
  2012年4月27日
摘要: 1 /* 2 * 题目要求:求一组点中距离最远的一对的距离 3 * 解法:凸包+枚举 4 */ 5 6 #include <cmath> 7 #include <cstdio> 8 #include <cstdlib> 9 #include <iostream>10 11 using namespace std;12 13 const int N = 50005;14 15 struct point {16 int x;17 int y;18 }p[N], stack[N];19 20 int dis(point A, point B) {21 阅读全文
posted @ 2012-04-27 07:26 Try86 阅读(240) 评论(0) 推荐(0)
  2012年4月26日
摘要: 1 /* 2 * 题目要求:求最近点对(一个点在station内,一个点在agent内) 3 */ 4 5 #include <cmath> 6 #include <cstdio> 7 #include <cstdlib> 8 #include <iostream> 9 #include <algorithm>10 11 using namespace std;12 13 const int N = 200005;14 const double INF = 1e20;15 16 struct point {17 int f;18 do 阅读全文
posted @ 2012-04-26 21:43 Try86 阅读(218) 评论(0) 推荐(0)
摘要: 1 /* 2 * 题目要求:求最近点对 3 */ 4 5 #include <cmath> 6 #include <cstdio> 7 #include <cstdlib> 8 #include <iostream> 9 #include <algorithm>10 11 using namespace std;12 13 const int N = 100005;14 const double INF = 1e15;15 16 struct point {17 double x;18 double y;19 }p[N];20 int 阅读全文
posted @ 2012-04-26 20:23 Try86 阅读(245) 评论(0) 推荐(0)
  2012年4月25日
摘要: 1 /* 2 * 题目要求:求三角形内接圆面积与外接圆面积之比 3 * 内切圆半径:r=2*s/(a+b+c) ; 4 * 外接圆半径为 R=(a*b*c)/(s*4); 5 * 对于一般的三角形,内切圆半径公式如下: 6 * r=sqrt[(p-a)(p-b)(p-c)/p] 7 * 在直角三角形的内切圆中,有这样两个简便公式: 8 * 1、两直角边相加的和减去斜边后除以2,得数是内切圆的半径。 9 * 2、两直角边乘积除以直角三角形周长,得数是内切圆的半径。 10 * 1、r=(a+b-c)/2(注:s是Rt△的面积,a, b是Rt△的2个直角边,c是斜... 阅读全文
posted @ 2012-04-25 22:10 Try86 阅读(409) 评论(0) 推荐(0)
摘要: 1 /* 2 * 题目要求:判断线段是否跟矩形相交 3 * 注意:线段完全在矩形内也是相交 4 * 解法:分别判断线段是否跟矩形的四条边相交,再判断线段的两个端点是否都在矩形内 5 */ 6 7 #include <cstdio> 8 #include <cstdlib> 9 #include <iostream>10 11 using namespace std;12 13 struct point {14 double x;15 double y;16 }A, B, C, D, E, F;17 18 double crossProd(point A, p 阅读全文
posted @ 2012-04-25 13:11 Try86 阅读(419) 评论(0) 推荐(0)
  2012年4月24日
摘要: 1 /* 2 * 凸包 3 * 注意:给出的点为整点数,不要设某一精度值! 4 */ 5 6 #include <cmath> 7 #include <cstdio> 8 #include <cstdlib> 9 #include <iostream>10 11 using namespace std;12 13 const int N = 1005;14 const double PI = 3.1415927;15 16 struct point {17 double x;18 double y;19 }p[N], stack[N];20 21 阅读全文
posted @ 2012-04-24 22:34 Try86 阅读(934) 评论(0) 推荐(0)
摘要: 1 /* 2 * 题目要求:对一组向量按与x轴的正向夹角从小到大排序 3 * 解法:借用求凸包的排序规则即可 4 */ 5 6 #include <cmath> 7 #include <cstdio> 8 #include <cstdlib> 9 #include <iostream>10 11 using namespace std;12 13 const int N = 105;14 const double eps = 1e-8;15 16 struct point {17 double x;18 double y;19 }p[N];20 阅读全文
posted @ 2012-04-24 22:07 Try86 阅读(283) 评论(0) 推荐(0)
摘要: 1 /* 2 * 题目要求:判断给出的一些折线段是否相交 3 * 解法:枚举每条折线段上的每段线段,判断其是否与其它折线段的线段相交 4 */ 5 6 #include <cstdio> 7 #include <cstdlib> 8 #include <iostream> 9 10 using namespace std;11 12 const int N = 35;13 const int M = 105;14 15 int num[N];16 struct point {17 double x;18 double y;19 }p[N][M];20 21 阅读全文
posted @ 2012-04-24 21:34 Try86 阅读(426) 评论(0) 推荐(0)
摘要: 1 /* 2 * 题目要求:求三角形的最大面积 3 * 方法:凸包+枚举凸包上的点 4 */ 5 6 #include <cmath> 7 #include <cstdio> 8 #include <cstdlib> 9 #include <iostream>10 11 using namespace std;12 13 const int N = 50005;14 const double eps = 1e-8;15 16 struct point {17 int x;18 int y;19 }p[N], stack[N];20 21 bool 阅读全文
posted @ 2012-04-24 18:53 Try86 阅读(658) 评论(0) 推荐(0)
  2012年4月23日
摘要: /* * pick定理的应用* pick定律: area = inside + onedge / 2 - 1; */#include <cmath>#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;struct point { int x; int y;}A, B, C;int crossProd(point A, point B, point C) { return (B.x-A.x)*(C.y-A.y) - (B.y-A.y)*(C.x-A.x) 阅读全文
posted @ 2012-04-23 22:05 Try86 阅读(241) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 14 下一页

点击右上角即可分享
微信分享提示