ACM必做50题的解题-计算几何(The ACM is going to do 50 problem solving -- calculate the geometry).docVIP
- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
ACM必做50题的解题-计算几何(The ACM is going to do 50 problem solving -- calculate the geometry)
ACM必做50题的解题-计算几何(The ACM is going to do 50 problem solving -- calculate the geometry)
The ACM does 50 problem solving - computational geometry. TXT is used for business, not for calculation. Relationships are meant to be maintained, not tested. Love is for love, not for harm. Money is for enjoyment, not for measurement. Lies are used to break, not to decorate. Trust is for settling, not for challenging. POJ 1113 WALL
Calculate the geometry and find the convex hull
The result of this is equal to the circumference of the convex hull of this polygon plus the circumference of the circle with radius of the radius
The steps are as follows:
1) the algorithm first seeks to find the lowest point on the bottom, and if the y-coordinate is the same, then the smallest point of the x-coordinate is found
2) then rank the Angle of the first p relative to the first p according to all the points, and only take the distance when the Angle is equal
The farthest point of firstP (sorting by hand, by hand)
3) and then use the Graham algorithm to find the convex hull
4) go for the job directly
# include iostream
# include cmath
# define PI (3.1415926)
# define MAX_N 1000
Using namespace STD.
/ / store the original input value, and rad is the radius of the input
Double cord [MAX_N + 2] [2], rad;
Int seq [MAX_N + 2];
Int stack [MAX_N + 2];
Int n, top;
Int firstP;
Int realN;
Void swap (int pos1, int pos2)
{
Int temp = seq [pos1];
Seq [pos1] = seq [pos2];
Seq [pos2] = temp;
}
Int dir (int nodes, int node1, int node2)
{
Double x1 = cord [node1] [0], y1 = cord [node1] [1];
Double x2 = cord [node2] [0], y2 = cord [node2] [1];
Double sx = cord [nodes].
Return (x2 - sx) * (y1 - sy) - (x1 - sx) * (y2 - sy);
}
Double getDist (int node1, int node2)
{
Double x1 = cord [node1] [0], y1 = cord [node1] [1];
Double x2 = cord [node2] [0], y2 = cord [node2] [1];
Double res = SQRT ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
Return res;
}
Int compare (int node1, int node2)
{
Double x1 = cord [node1] [0
您可能关注的文档
- 高中物理必背知识点实用口诀(TXT手机版)(Practical tips for high school physics (TXT)).doc
- 高中物理解题方法(High school physics problem method).doc
- 高中课本中出现的生物史(The history of biology in high school textbooks).doc
- 高中生物实验汇总(High school biology experiment summary).doc
- 高二下学期化学复习计划03月23日(The chemistry review program for the second term is March 23).doc
- 高二 (上)文化生活 考试试题(High school cultural life exam).doc
- 高二哲学第三课测试题(High 2 philosophy lesson 3).doc
- 高二化学学业水平测试知识点强化(High level 2 chemical study level test knowledge point reinforcement).doc
- 高二化学知识点(High two chemical knowledge points).doc
- 高二地理周练五(Gao ii geography week 5).doc
- DRAC使用讲义(DRAC USES handouts).doc
- DTL和TTL(DTL and TTL).doc
- DropDownList详解(DropDownList,).doc
- dsafa 文本文档(Dsafa text document).doc
- DSP常用函数(DSP common functions).doc
- EDID知识简介(Knowledge profile of EDID).doc
- DUPONT 产 品(DUPONT products).doc
- D开头的英文单词(The English word at the beginning of D).doc
- eMule源代码解析-1(EMule source code parsed - 1).doc
- EN目录1(EN directory 1).doc
文档评论(0)