
ACM_计算几何
羁绊残阳
四川大学计算机科学与技术
展开
-
hdu 1007 平面最近点对 分治
平面上的分治,把取余分割,然后合并的时候有剪枝。 这里学会了归并合并函数inplace_merge(a, a + m, a + n, cmp) 以mm为分界线分别已经排序好了,只需要按照小于操作符合并就可以了。当然自己实现也只是双指针的问题。#include <cstdio> #include <cstring> #include <cmath> #include <iostream> #inc原创 2016-07-26 11:18:33 · 363 阅读 · 0 评论 -
SCU2016-01 P 二分 + 叉积应用
Analyse: 对于每个点,二分它在哪个区域内。 二分的时候需要利用到判断点在线的那一侧。 这里要用到叉积(相对于点积)。 (x1,y1)×(x2,y2)=x1∗y2−x2∗y1(x_1, y_1) \times (x_2, y_2) = x_1 * y_2 - x_2 * y_1 A×B=−B×A=|A|∗|B|∗sinθ=S菱形A\times B= -B\times A=|A|*|B原创 2016-07-05 23:51:30 · 253 阅读 · 0 评论 -
SCU2016-02 P题 (凸包)
分析:内部图案虽然可以凹下去,但是外壳是凸的,这样就才会更节省材料,然后发现就是求凸包周长即可。#include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <vector> #include <iostream> #include <algorithm> using namespace std;原创 2016-09-09 17:18:07 · 269 阅读 · 0 评论