题意:给你一些点,找出两个可以包含所有点的矩形,一个保证矩形面积最小,一个保证矩形周长最小,输出两个最小值 题解:首先根据所有点求一个凸包,再在这个凸包上枚举每条边,作为矩形的一条边(这样可以保证最小) 接着根据旋转卡壳的思想求出另外三条边,这样枚举判断就好 求另三条边时首先方向是确定了的,找点就是旋转卡壳,思想就是:枚举的任意两条边a与b,a的另三条边与b的另三条边都不会再a与b之间,并且b对应边一定最a对应边的      后面(注意是循环的边)那么就是说,我们可以使用类似双指针方式维护,但是…
https://vjudge.net/problem/UVA-12307 求覆盖所有点的最小矩形面积.周长 相当于求凸包的最小面积外接矩形.最小周长外接矩形 结论: 这个矩形一定有一条边和凸包上一条边重合 证明去看https://wenku.baidu.com/view/f11d0836ee06eff9aef807d9.html 枚举一条边,用旋转卡壳求其他三边 假设现在正枚举到A点,对应紫色边, 显然,紫色边的对边一定 过A点的对踵点且与紫色边平行 那么矩形的高|BH|=AE.AB的叉积/ |…
Smallest Bounding Rectangle Given the Cartesian coordinates of n(>0)2-dimensional points, write a program that computes the area of their smallest bounding rectangle (smallest rectangle containing all the given points). Input The input le may contain…
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=17267 [思路] 凸包+旋转卡壳 求出凸包,用旋转卡壳算出凸包的直径即可. [代码] #include<cstdio> #include<vector> #include<iostream> #include<algorithm> using namespace std; struct Pt { int x,y; Pt(,):…
旋转卡壳求凸包直径. 参考:http://www.cppblog.com/staryjy/archive/2010/09/25/101412.html #include <cstdio> #include <cmath> #include <algorithm> using namespace std; << ; struct Point { int x, y; Point( , ):x(x), y(y) { } }; typedef Point Vecto…
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4199 没想透为啥旋转卡壳跟枚举跑时间差不多.n太小吧! 枚举法: #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<al…
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1393 http://poj.org/problem?id=2187 Beauty Contest 1393: Robert Hood Description Input Output Sample Input 5 -4 1 -100 0 0 4 2 -3 2 300 Sample Output 316.86590223 HINT Source 分析: 给你 N 个点, 求所有点中最远两点距离.即…
题意: 给你两个凸包,求其最短距离. 解法: POJ 我真的是弄不懂了,也不说一声点就是按顺时针给出的,不用调整点顺序. 还是说数据水了,没出乱给点或给逆时针点的数据呢..我直接默认顺时针给的点居然A了,但是我把给的点求个逆时针凸包,然后再反转一下时针顺序,又WA了.这其中不知道有什么玄机.. 求凸包最短距离还是用旋转卡壳的方法,这里采用的是网上给出的一种方法: 英文版:        http://cgm.cs.mcgill.ca/~orm/mind2p.html 中文翻译版:  http:/…
因为凸壳上对踵点的单调性所以旋转卡壳线性绕一圈就可以啦啦啦--- 先求凸包,然后旋转卡壳记录$sum1$和$sum2$,最后统计答案就可以了 #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> #define read(x) x=getint() #define N 2003 using namespace std; inline int dcmp(double x)…
给定点集的最远两点的距离. 先用graham求凸包.旋(xuán)转(zhuàn)卡(qiǎ)壳(ké)求凸包直径. ps:旋转卡壳算法的典型运用 http://blog.csdn.net/hanchengxi/article/details/8639476. #include <cstdio> #include <cmath> #include <algorithm> #define sqr(x) (x)*(x) #define N 50001 using names…