题目大意: 平面上有n个两两不相交的圆,给定圆的圆心(x,y)和半径 r 求所有最外层的 即 不包含于其他圆内部的圆 挑战258页 平面扫描 记录所有圆的左端和右端 排序后 逐一扫描 将到当前圆为止的最外层的圆存入数组 当遇到一个圆的左端 判断 这个圆 是否被 离它最近的上下的两个已存入的最外层的圆 包含 若被包含 则跳过该圆 若未被包含 说明其是一个最外层的圆 存入数组 这里不会有 它包含上下其中某个圆 的情况出现 因为包含某个圆 那么 该圆的左端 必定位于 被包含圆的左端的左边 但是平面扫描…
求n个圆中没有被包含的圆.模仿扫描线从左往右扫,到左边界此时如有3个交点,则有3种情况,以此判定该圆是否被离它最近的圆包含,而交点和最近的圆可以用以y高度排序的Set来维护.因此每次到左边界插入该圆,找该圆最近的两个圆(上方和下方)判断是否包含,到右边界则从Set中删除该圆. /** @Date : 2017-08-13 17:27:55 * @FileName: POJ 2932 圆扫描线.cpp * @Platform: Windows * @Author : Lweleth (SoungE…
题目大意:首先给一个圆的半径和圆心,然后给一个多边形的所有点(多边形按照顺时针或者逆时针给的),求,这个多边形是否是凸多边形,如果是凸多边形在判断这个圆是否在这个凸多边形内.   分析:判断凸多边形可以使用相邻的三个点叉积判断,因为不知道顺时针还是逆时针,所以叉积如果有有整数和负数,那么一定不是凸多边形(注意允许多多点在一条线段上).判断圆在凸多边形首先要判断圆心是否在多边形内,如果在多边形内,再次判断圆心到达到变形每条边的最短距离,如果小于半径就是不合法.ps:一道好题,通过这个题学会了不少东…
Coneology Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3574   Accepted: 680 Description A student named Round Square loved to play with cones. He would arrange cones with different base radii arbitrarily on the floor and would admire…
原题如下: Coneology Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 4937   Accepted: 1086 Description A student named Round Square loved to play with cones. He would arrange cones with different base radii arbitrarily on the floor and would…
Description Given a rectangle and a circle in the coordinate system(two edges of the rectangle are parallel with the X-axis, and the other two are parallel with the Y-axis), you have to tell if their borders intersect. Note: we call them intersect ev…
poj 1064 Cable master 判断一个解是否可行 浮点数二分 题目链接: http://poj.org/problem?id=1064 思路: 二分答案,floor函数防止四舍五入 代码: #include <iostream> #include <stdio.h> #include <math.h> #include <algorithm> using namespace std; const int maxn = 10005; const…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1221 Rectangle and Circle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3434    Accepted Submission(s): 904 Problem Description Given a rectangle…
POJ1584 题意:给定n条边首尾相连对应的n个点 判断构成的图形是不是凸多边形 然后给一个圆 判断圆是否完全在凸包内(相切也算) 思路:首先运用叉积判断凸多边形 相邻三条边叉积符号相异则必有凹陷 O(n) 之后首先判断圆心是否在凸多边形内 如果凸多边形的点有序 则可以在logn时间内判断 否则先排序再判断 O(nlogn) 然后用每条边(线段)判断到圆心的距离即可 这道题也没给数据范围 O(nlogn)是可以AC的. #include<iostream> #include<stdio…
作者: Panagiotis Bouros ∗Department of Computer ScienceAarhus University, Denmarkpbour@cs.au.dkNikos Mamoulis †Dept. of Computer Science & EngineeringUniversity of Ioannina, Greecenikos@cs.uoi.gr 翻译:陈祥春 摘要 区间连接是在时间,空间和不确定数据库中查找应用程序的基本操作.尽管已经提出了许多用于区间连接…
题目链接 题意:有n个圆,圆之间不存在相交关系,求有几个不被其他任何圆包含的圆,并输出圆的编号: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <queue> #include <map> #include <al…
平面上有n个两两没有公共点的圆,i号圆的圆心在(xi,yi),半径为ri,编号从1开始.求所有最外层的,即不包含于其他圆内部的圆.输出符合要求的圆的个数和编号.n<=40000. (注意此题无相交相切!!!)工具:扫描线+set 中心思想:边界分左右端点,如图,当扫描线与k号圆左端点相切,之前用set维护一个y纵坐标的二叉树,那我们在二叉树中查找离k号圆纵坐标最近的上下两个圆(A,B),让k与A,B判是否内含即可,为什么是AB?假设有C点(离k远一些)包含k,但A不包含k,那么一定有A,C相交,…
题目大意: 给定n,n边形 给定圆钉的 半径r 和圆心(x,y) 接下来n行是n边形的n个顶点(顺时针或逆时针给出) 判断n边形是否为凸包 若不是输出 HOLE IS ILL-FORMED 判断圆心和整个圆是否在多边形内 若是 输出 PEG WILL FIT 若不是 输出 PEG WILL NOT FIT 这道题 嗯 有个地方注意一下 就是多边形三点共线时也符合要求的凸包的 所以在检查是否符合凸包时 =0即共线的情况也是符合的 ; /// 这里凸包的判断不能只是<0 应该是<=0 while(…
[题目链接] http://poj.org/problem?id=2932 [题目大意] 给出N个两两没有公共点的圆,求所有不包含于其它圆内部的圆 [题解] 我们计算出所有点在圆心所有y位置的x值, 由于两两没有公共点,所以当我们对所有的x坐标进行扫描时,只要扫描相邻的x, 判定扫描到的圆和与其x相邻的圆是否是圆包含关系就可以判断一个圆的位置 扫描到左端点时,如果圆其被包含,则什么都不做,否则,将这个圆加入set中, 当扫描到右端点时,如果圆被包含,则什么都不做,否则将圆从set中去除. [代码…
题目链接:POJ 3805 Problem Description Numbers of black and white points are placed on a plane. Let's imagine that a straight line of infinite length is drawn on the plane. When the line does not meet any of the points, the line divides these points into t…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Viva Confetti Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 881   Accepted: 361 Description Do you know confetti? They are small discs of colored paper, and people throw them a…
题目大意 给定平面上N个矩形的位置(给出矩形的左下角和右上角的坐标),这些矩形有些会有重叠,且重叠只会出现矩形的边重合全部或部分,矩形的顶点重合,而不会出现一个矩形的顶点位于另一个矩形的内部.     求出所有不重叠的矩形的个数. 题目分析 将每个矩形分成4个点,记录每个点所属的矩形id,对4*N个点进行按照x坐标和y坐标排序.     然后,沿着x方向进行扫描,对于相同的x,沿着该x坐标,从下向上找那些x坐标等于x的点的y坐标,判断该点所在矩形是否出现重合.若重合,则将该点所属的矩形记为重叠.…
之前常用stristr ,  strpos判断. 因为处理1000W * 1000W级别,循环就是漫长漫长... 在此,对stristr, strpos, explode判断字符串包含关系处理速度对比: Header("Content-Type:text/html;charset=utf-8"); ini_set('memory_limit','-1'); set_time_limit(0); $count = 10000000;//循环次数 $str1 = 'abcdef'; $st…
题目意思是求起点s到终点s的最短路,但是只能在圆的内部和边上走.一种可以想到的方法就是求出所有的交点,然后两两连边并验证合法性,但是这样的交点数规模有n2. 我们可以观察发现,我们在圆求并构成的图形中,在其内部的点是不可能成为最短路上的点,只可能是沿着边上的点擦着经过,所以我们需要把在圆内部的所有点都给扣掉,同样可以证明这样的点的规模只有n个,接下来只需要暴力连边,但是连边的时候需要验证这样的点对是否沿着直线可达.我是直接将这条线段暴力和所有圆求交点,左侧端点计为1,右侧端点计为-1,然后用类似…
题目链接:POJ 1269 Problem Description We 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) intersect in a line becau…
题目传送门:POJ 3304 Segments Description Given 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 common. Inp…
数据范围很大,用米勒罗宾测试和Pollard_Rho法可以分解大数. 模板在代码中 O.O #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> using namespace std; __int64 pri[]= {,,,,,,,,,,};//用小素数表做随机种子避免第一类卡米歇尔数的误判 __int64 mul…
http://poj.org/problem?id=1410 Intersection Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11329   Accepted: 2978 Description You are to write a program that has to decide whether a given line segment intersects a given rectangle. An ex…
Geometric Shapes Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 1243   Accepted: 524 Description While creating a customer logo, ACM uses graphical utilities to draw a picture that can later be cut into special fluorescent materials. To…
Intersection Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9996   Accepted: 2632 Description You are to write a program that has to decide whether a given line segment intersects a given rectangle. An example: line: start point: (4,9) …
Pick-up sticks Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 10330   Accepted: 3833 Description Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to fin…
/*************** poj 3335 点序顺时针 ***************/ #include <iostream> #include <cmath> #include <algorithm> using namespace std; ; const double maxn = 0x7f7f7f7f; int dcmp(double x){ if(fabs(x)<eps) ; else ?-:; } struct point { double…
这道题得控制好精度,不然会贡献WA  QAQ 还是那个规则: int sgn(double x){ if(x > eps) return 1; else if(x < - eps) return -1; else return 0; } 思路:把简单多边形的每一个点和原点连线,就把这个多边形和圆的交变成了多个三角形与圆的交,根据有向面积的思路,加加减减就可以得到公共面积. 贴上代码了- #include <cstdio> #include <cstring> #incl…
Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move sequence is represented by a string. And each move is represent by a characte…
Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can be several points specializing in the same pair o…