HDU 1392 凸包】的更多相关文章

1.HDU 1392 Surround the Trees 2.题意:就是求凸包周长 3.总结:第一次做计算几何,没办法,还是看了大牛的博客 #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm> #include<cstdio> #include<cstdlib> #define F(i,a,b) f…
Surround the Trees Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10345    Accepted Submission(s): 4009 Problem Description There are a lot of trees in an area. A peasant wants to buy a rope to…
//用的自己的计算几何模板,不过比较慢嘿嘿 //要注意只有一个点和两个点 //Computational Geometry //by kevin_samuel(fenice) Soochow University //temple #include <iostream> #include <cmath> #include <algorithm> #include <cstdio> //#include <stack> using namespac…
<题目链接> 题目大意: 给出一些点,让你求出将这些点全部围住需要的多长的绳子. Andrew算法 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; struct node{ int x,y; }; node vex[]; bool cmp1(node a,node…
Problem Description There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he must know the minimal required length of the rope. However, he does not know how to calculate it. Can you help him? The…
Surround the Trees Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10803    Accepted Submission(s): 4187 Problem Description There are a lot of trees in an area. A peasant wants to buy a rope t…
Surround the Trees:http://acm.hdu.edu.cn/showproblem.php?pid=1392 题意: 在给定点中找到凸包,计算这个凸包的周长. 思路: 这道题找出凸包上的点后,s数组中就是按顺序的点,累加一下距离就是周长了. #include <algorithm> #include <iterator> #include <iostream> #include <cstring> #include <cstdli…
题目链接:HDU 1392 Problem Description There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he must know the minimal required length of the rope. However, he does not know how to calculate it. Can you…
给你n个点,具有速度,一个位置如果有其他点能够先到,则不能继续访问,求出里面这些点哪些点是能够无限移动的. 首先我们考虑到,一个速度小的和一个速度大的,速度小的必定只有固定他周围的一定区域是它先到的,而其他地方都是速度大的先到. 再来如果有相同速度的两点,前连线的中垂线则是它们先到的界限,如果一个点在多边形的内部,那么它必定会被与其他点连线的中垂线所包围. 因此,只要选出最大速度的点,在里面找凸包即可.但是还有很多细节,比如点重合的情况...如果速度一样的点重合,该点也不能无限移动,但是求凸包时…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1392 这里介绍一种求凸包的算法:Graham.(相对于其它人的解释可能会有一些出入,但大体都属于这个算法的思想,同样可以解决凸包问题) 相对于包裹法的n*m时间,Graham算法在时间上有很大的提升,只要n*log(n)时间就够了.它的基本思想如下: 1.首先,把所有的点按照y最小优先,其次x小的优先排序 2.维护一个栈,用向量的叉积来判断新插入的点跟栈顶的点哪个在外围,如果栈顶的点在当前插入的点的…