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 阅读(246) 评论(0) 推荐(0)
摘要: /** 题目要求:求面积最大的那个面的编号* 方法:分别求每个面的面积,并比较最大的面积 */#include <cmath>#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;const int N = 55;struct point { int x; int y;}p[N], sp[N];double crossProd(point A, point B, point C) { return (B.x-A.x)*(C.y-A.y) - (B.y-A 阅读全文
posted @ 2012-04-23 21:46 Try86 阅读(219) 评论(0) 推荐(0)
摘要: /* 凸包+最小圆覆盖 枚举任意3点找其最小覆盖圆(当为钝角三角形时不是外接圆,而是以其最长边为直径的圆)。 当为外接圆时,半径公式为r=abc/4s;(推导为如下: 由正弦定理,a/sinA=b/sinB=c/sinC=2R,得sinA=a/(2R), 又三角形面积公式S=(bcsinA)/2,所以S=(abc)/(4R),故R=(abc)/(4S).*/#include <cmath>#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;const 阅读全文
posted @ 2012-04-23 21:01 Try86 阅读(1246) 评论(0) 推荐(0)
摘要: /** 题目要求:求凸包的周长 */#include <cmath>#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;const int N = 105;const double eps = 1e-8;struct point { int x; int y;}p[N], stack[N];bool isZero(double x) { return (x > 0 ? x : -x) < eps;}double dis(point A, p 阅读全文
posted @ 2012-04-23 18:46 Try86 阅读(884) 评论(0) 推荐(0)