![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
计算几何
_Ark
这个作者很懒,什么都没留下…
展开
-
计算几何模板初步
#include <set>#include <cmath>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 1005;const double Pi = acos(-1.0);const ...原创 2019-02-14 09:03:18 · 169 阅读 · 0 评论 -
BZOJ 1845: [Cqoi2005] 三角形面积并 (辛普森积分)
大力辛普森积分精度什么的搞了我好久…学到了Simpson的一个trick速度成功BZOJ倒数CODE#include <bits/stdc++.h>using namespace std;const int MAXN = 205;const double eps = 1e-13;inline double sqr(double x) { return x*x; }i...原创 2019-04-03 19:10:18 · 249 阅读 · 0 评论 -
BZOJ 1007: [HNOI2008]水平可见直线 (半平面交)
eps害人啊…我开到1e-10都不够,1e-12才够.然鹅我看有的代码不用写eps都过了…蒟蒻被动:被卡精度.#include <bits/stdc++.h>using namespace std;const double eps = 1e-12;const int MAXN = 50005;inline double sqr(double x) { return x*x...原创 2019-04-02 21:39:50 · 160 阅读 · 0 评论 -
BZOJ 1038: [ZJOI2008]瞭望塔
半平面交后,可能成为答案的点就是凸包上的点 和 山峰(分段函数的分段点).枚举一下就行了.#include <bits/stdc++.h>using namespace std;const double eps = 1e-10;const int MAXN = 505;inline double sqr(double x) { return x*x; }inline do...原创 2019-04-02 21:15:22 · 168 阅读 · 0 评论 -
BZOJ 2618: [Cqoi2006]凸多边形 (半平面交)
模板CODE#include <bits/stdc++.h>using namespace std;const double eps = 1e-10;const int MAXN = 505;inline double sqr(double x) { return x*x; }inline double dcmp(double x) { if(x < -ep...原创 2019-04-02 20:19:51 · 131 阅读 · 0 评论 -
BZOJ 1027: [JSOI2007]合金 (计算几何+Floyd求最小环)
题解就看这位仁兄的吧…不过代码还是别看他的了…同样的方法…我200ms,他2000ms.常数的幽怨…CODE#include <bits/stdc++.h>using namespace std;const int MAXN = 505;const double eps = 1e-8;struct Point { double x, y; Point(){} Po...原创 2019-04-04 16:07:56 · 132 阅读 · 0 评论 -
BZOJ 2178: 圆的面积并 (辛普森积分)
code#include <set>#include <cmath>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 1005;const double Pi = acos(-1.0);c...原创 2019-04-03 23:07:48 · 202 阅读 · 0 评论 -
BZOJ 1043: [HAOI2008]下落的圆盘
暴力枚举每个圆后面的所有圆对这些圆每个与当前圆计算覆盖的弧度(有两个半径一个圆心距可以用余弦定理)把算出来的这些弧度存进栈里最后一起统计一下总共覆盖多少弧度,再计算剩余部分弧长(摘自CreationAugust 的博客)CODE#include <set>#include <cmath>#include <cstdio>#include <...原创 2019-04-03 22:57:41 · 130 阅读 · 0 评论 -
BZOJ 3630: [JLOI2014]镜面通道 (网络流 +计算几何)
水能流过的地方光都能达到呵呵.jpg那就是裸的最小割(割开上边界和下边界)了…判矩形和圆相交的时候就用圆心对矩形求一次点到矩形的最近距离(类似KD树的预估函数).CODE#include <vector>#include <cstdio>#include <cstring>#include <algorithm>using na...原创 2019-04-03 22:29:43 · 115 阅读 · 0 评论 -
BZOJ 3210: 花神的浇花集会 (切比雪夫距离)
GXZlegendCODE#include <bits/stdc++.h>using namespace std;#define LL long longconst int MAXN = 100005;int n, a[MAXN], b[MAXN], x[MAXN], y[MAXN];inline LL f(int px, int py) { LL re = 0; f...原创 2019-04-03 21:50:12 · 148 阅读 · 0 评论 -
BZOJ 2458: [BeiJing2011]最小三角形 (分治)
分治就是了.类似于分治找最近/远点对.CODE#include <bits/stdc++.h>using namespace std;const double eps = 1e-13;const int MAXN = 200005;const double INF = 1e15;#define sqr(x) ((x)*(x))struct Point { doubl...原创 2019-04-03 20:13:45 · 151 阅读 · 0 评论