摘要: Painting A BoardTime Limit:1000MSMemory Limit:10000KTotal Submissions:3018Accepted:1441DescriptionThe CE digital company has built an Automatic Painting Machine (APM) to paint a flat board fully covered by adjacent non-overlapping rectangles of different sizes each with a predefined color.To color t 阅读全文
posted @ 2013-05-13 12:25 3111006139 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题意:一个凸包丢失了一些点后,问是否可以用剩下的这些点唯一确定以前的凸包。解法:先求出这些点的凸包,然后判断每条边上是否至少有3个点(含顶点),如果有,那么可以唯一确定以前的凸包。View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <iostream> 5 #include <algorithm> 6 #include <queue> 7 #include <vector> 8 #includ 阅读全文
posted @ 2012-09-14 10:04 3111006139 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 1750. Pakhom and the GullyTime Limit: 1.0 secondMemory Limit: 64 MBPakhom stands at the point S and wants to reach the point T to buy the land there. But he noticed a gully, which represents a polyline ABC. What is the length of the shortest path Pakhom should walk if he doesn't want to fall int 阅读全文
posted @ 2012-09-13 15:02 3111006139 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 给定一个多边形:如何求重心??三角形的重心是: (x1+x2+x3) / 3,(y1+y2+y3) / 3(质点系重心公式)一个由 N 个顶点( xi, yi)确定的不自交闭多边形的中心能如下计算:记号( xN, yN)与顶点( x0, y0)相同。多边形的面积为:多边形的中心由下式给出:推论过程:将多边形剖分成N个三角形,分别求出其重心和面积,这时可以想象,原来质量均匀分布在内部区域上,而现在质量仅仅分布在这N个重心点上(等假变换),这时候就可以利用刚才的质点系重心公式了。 不过,要稍微改一改,改成加权平均数,因为质量不是均匀分布的,每个质点代表其所在三角形,其质量就是该三角形的面积(有向面 阅读全文
posted @ 2012-09-10 09:57 3111006139 阅读(1011) 评论(0) 推荐(0) 编辑
摘要: Intersecting LinesTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 7341Accepted: 3381DescriptionWe all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) inter 阅读全文
posted @ 2012-08-27 17:09 3111006139 阅读(227) 评论(0) 推荐(0) 编辑
摘要: SegmentsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6615Accepted: 1981DescriptionGiven n segments in the two dimensional space, write a program, which determines if there exists a line such that after projecting these segments on it, all projected segments have at least one point in com 阅读全文
posted @ 2012-08-27 16:18 3111006139 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Toy StorageTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2764Accepted: 1564DescriptionMom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. They gave Reza a rectangular box to put his toys in. Unfortunately, Reza is rebellious and o 阅读全文
posted @ 2012-08-27 15:26 3111006139 阅读(123) 评论(0) 推荐(0) 编辑
摘要: TOYSTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 7630Accepted: 3628DescriptionCalculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They gave John a rectan 阅读全文
posted @ 2012-08-27 15:02 3111006139 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 要想计算多边形的面积我们可以转化为求多个三角形的面积之和得到:在解析几何里, △ABC的面积可以通过如下方法求得: 点坐标 => 边长 => 海伦公式 => 面积 但是问题就出现在这里了,用这种方法做的话,计算量大,精度损失。这里就利用到叉积了:叉积的几何意义 叉积的长度 |a × b| 可以解释成以a和b为边的平行四边形的面积。进一步就是说,三重积可以得到以a,b,c为边的平行六面体的体积。 a x b = a*b*sin θ ;a = (x1,y1) ,b = (x2,y2) ; a x b = x1y2 - x2y1 ;所以得到多边形面积公式:A=sigma( 阅读全文
posted @ 2012-08-24 19:43 3111006139 阅读(822) 评论(0) 推荐(0) 编辑
摘要: 最近点对问题定义:已知上m个点的集合,找出对接近的一对点。 在二维空间里,可用分治法求解最近点对问题。预处理:分别根据点的x轴和y轴坐标进行排序,得到X和Y,很显然此时X和Y中的点就是S中的点。情况(1):点数小于等于三时: 情况(2):点数大于三时:首先划分集合S为SL和SR,使得SL中的每一个点位于SR中每一个点的左边, 并且SL和SR中点数相同。分别在SL和SR中解决最近点对问题,得到DL和DR,分别表示SL和SR中的最近点对的距离。令d=min(DL,DR)。 如果S中的最近点对(P1,P2)。P1、P2两点一个在SL和一个在SR中,那么P1和P2一定在以... 阅读全文
posted @ 2012-08-24 18:53 3111006139 阅读(308) 评论(0) 推荐(0) 编辑