Moon Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Fat brother and Maze are playing a kind of special (hentai) game in the clearly blue sky which we can just consider as a kind of two-dime…
 FZU 2148  Moon Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description Fat brother and Maze are playing a kind of special (hentai) game in the clearly blue sky which we can just consider as a kind of two-dimen…
Moon Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2148 Description Fat brother and Maze are playing a kind of special (hentai) game in the clearly blue sky which we can just consider as…
题目链接 题意 : 给你n个点,判断能形成多少个凸四边形. 思路 :如果形成凹四边形的话,说明一个点在另外三个点连成的三角形内部,这样,只要判断这个内部的点与另外三个点中每两个点相连组成的三个三角形的面积和要与另外三个点组成的三角形面积相同. 中途忘了加fabs还错了好几次 //FZU2148 #include <cstdio> #include <cstring> #include <iostream> #include <cmath> #define e…
题意:给一些点,问这些点能够构成多少个凸四边形 做法: 1.直接判凸包 2.逆向思维,判凹包,不是凹包就是凸包了 怎样的四边形才是凹四边形呢?凹四边形总有一点在三个顶点的内部,假如顶点为A,B,C,D,则构成四个三角形:ABC,ACD,ABD,BCD,假如某一个三角形(最外的三个顶点)的面积等于另三个三角形面积之和,则是凹四边形. 然后做四个for循环,枚举即可,因为N最多才30. 代码: #include <iostream> #include <cstdio> #include…
A Round Peg in a Ground Hole Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6682   Accepted: 2141 Description The DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to on…
蛋疼的蚂蚁 Time Limit: 1000 MS     Memory Limit: 65536 K Total Submit: 39(22 users)    Total Accepted: 26(21 users) Rating: Special Judge: No Description 大千世界无奇不有,最近科学家发现一种蚂蚁,它头部只有一只左眼,并且 三只脚在身子的右侧,因此:1,它不能转向右侧.2,它的行走会留下一条红印.3,它行走不会在经过以前 走过的红印. 这种蚂蚁需要每天吃一…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2876   Accepted: 1839 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y19…
                                                                                              Problem 2148 Moon Game Problem Description Fat brother and Maze are playing a kind of special (hentai) game in the clearly blue sky which we can just consid…
题目链接:https://vjudge.net/problem/POJ-1584 题意:首先要判断凸包,然后判断圆是否在多边形中. 思路: 判断凸包利用叉积,判断圆在多边形首先要判断圆心是否在多边形中,然后判断圆心到每条边的距离是否小于半径.板子很重要!! AC code: #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<cstdlib>…
2019 杭电多校 1 1013 题目链接:HDU 6590 比赛链接:2019 Multi-University Training Contest 1 Problem Description After returning with honour from ICPC(International Cat Programming Contest) World Finals, Tom decides to say goodbye to ICPC and start a new period of l…
题目链接: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…
Codeforces Round #113 (Div. 2) 题目链接:Polygons You've got another geometrical task. You are given two non-degenerate polygons \(A\) and \(B\) as vertex coordinates. Polygon \(A\) is strictly convex. Polygon \(B\) is an arbitrary polygon without any sel…
题目:http://acm.fzu.edu.cn/problem.php?pid=2148 题意:给出n个点,判断可以组成多少个凸四边形. 思路: 因为n很小,所以直接暴力,判断是否为凸四边形的方法是: 如果4个点中存在某个点D,Sabd + Sacd + Sbcd = Sabc,则说明是凹四边形. #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #inc…
凸包 (只针对二维平面内的凸包) 一.定义 简单的说,在一个二维平面内有n个点的集合S,现在要你选择一个点集C,C中的点构成一个凸多边形G,使得S集合的所有点要么在G内,要么在G上,并且保证这个凸多边形的面积最小,我们要求的就是这个C集合. 二.算法 求凸包的算法很多,常用的有两种: 1.  Graham扫描法,运行时间为O(nlgn). 2.  Jarvis步进法,运行时间为O(nh),h为凸包中的顶点数. 这里主要讨论第一种算法:Graham扫描法 Graham扫描法: 基本思想:使用一个栈…
Wall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28157   Accepted: 9401 Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he wo…
模板敲错了于是WA了好几遍…… 判断由红点和蓝点分别组成的两个凸包是否相离,是输出Yes,否输出No. 训练指南上的分析: 1.任取红凸包上的一条线段和蓝凸包上的一条线段,判断二者是否相交.如果相交(不一定是规范相交,有公共点就算相交),则无解 2.任取一个红点,判断是否在蓝凸包内.如果是,则无解.蓝点红凸包同理. 其中任何一个凸包退化成点或者线段时需要特判. 其实只需要把上面两个判断顺序颠倒一下,就可以不需要特判. 先判断点是否在凸包内,因为这个考虑了点在凸包边界上的情况,所以后面判凸包线段是…
1.poj1113 Wall 题目:http://poj.org/problem?id=1113 题意:用一条线把若干个点包起来,并且线距离任何一个点的距离都不小于r.求这条线的最小距离是多少? 分析:这道题的答案是凸包周长加上一个圆周长,即包围凸包的一个圆角多边形,但是没弄明白那些圆角加起来为什么恰好是一个圆.每个圆角是以凸包对应的顶点为圆心,给定的L为半径,与相邻两条边的切点之间的一段圆弧.每个圆弧的两条半径夹角与对应的凸包的内角互补.假设凸包有n条边,则所有圆弧角之和为180°*n-180…
题目传送门 题意:给了n个点的坐标,问能有几个凸四边形 分析:数据规模小,直接暴力枚举,每次四个点判断是否会是凹四边形,条件是有一个点在另外三个点的内部,那么问题转换成判断一个点d是否在三角形abc内 易得S (abd) + S (acd) + S (bcd) == S (abc),求三角形面积 收获:比赛时没写出来,没想到用面积就轻松搞定,脑子有点乱,开始敲了计算几何点是否在凸多边形内的模板,WA了,整个人都不好了.收获就是要把计算几何的基础补上来 代码: /*****************…
POJ1912 给定n个点 和若干条直线,判断对于一条直线,是否存在两个点在直线的两侧. 显然原命题等价于 凸包与直线是否相交. O(n)的算法是显而易见的 但是直线数量太多 就会复杂到O(n^2)由于n<=100000 会TLE 凸包有个很好的性质,我们没有利用, 那就是凸包的边相对于要判断的直线是极角有序的! 于是得到算法: 构造好凸包后,二分找凸包上第一个与正向直线夹角大于0的线段和第一个与反向直线夹角大于0的线段 然后判断两线段的起点是否在直线两侧即可. 代码实现有一点注意的细节:不要用…
Jack Straws In the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table and players try to remove them one-by-one without disturbing the other straws. Here, we are only concerned with if various pairs of straws are…
题目大意: 给定n,n边形 给定圆钉的 半径r 和圆心(x,y) 接下来n行是n边形的n个顶点(顺时针或逆时针给出) 判断n边形是否为凸包 若不是输出 HOLE IS ILL-FORMED 判断圆心和整个圆是否在多边形内 若是 输出 PEG WILL FIT 若不是 输出 PEG WILL NOT FIT 这道题 嗯 有个地方注意一下 就是多边形三点共线时也符合要求的凸包的 所以在检查是否符合凸包时 =0即共线的情况也是符合的 ; /// 这里凸包的判断不能只是<0 应该是<=0 while(…
题意:给n个点,|x[i]|,|y[i]| <= 1e9.求在所有情况下的子集下(子集点数>=3),凸包的面积和. 这题主要有几个方面,一个是凸包的面积,可以直接用线段的有向面积和求得,这个当时没想到.还有就是,在180度以内的点数. 所以实际上是枚举2个点作为某个凸包的一条边,看有多少个这样的凸包.那个2^num - 1是保证除了2个点外至少还需1个点才能构成凸包. 时间复杂度O(n*n*logn) #include <cstdio> #include <cstring&g…
Pick-up sticks Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 8862   Accepted: 3262 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 find…
DESCRIPTION: 判断空间点 P(x, y, z)是否在一个四面体的内部? Let the tetrahedron have vertices V1 = (x1, y1, z1) V2 = (x2, y2, z2) V3 = (x3, y3, z3) V4 = (x4, y4, z4) and your test point be P = (x, y, z). Then the point P is in the tetrahedron if following fivedetermin…
这道题是水题,发现平移某些边,答案就是圆心的凸包+一个圆的周长. 不要忽视精度误差! #include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include <cmath> using namespace std; ; ; const double Pi=acos(-1.0); int sgn(double x){ ; ; ; } struct…
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 diameter and length…
Wall Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3779    Accepted Submission(s): 1066 Problem Description Once upon a time there was a greedy King who ordered his chief Architect to build a…
[科普]什么是BestCoder?如何参加? Surround the Trees Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8113    Accepted Submission(s): 3095 Problem Description There are a lot of trees in an area. A peasant…
题目大意:给出平面上许多矩形的中心点和倾斜角度,计算这些矩形面积占这个矩形点形成的最大凸包的面积比. 算法:GRAHAM,ANDREW. 题目非常的简单,就是裸的凸包 + 点旋转.这题自己不会的地方就是点旋转,另外,Andrew 算法还没有调试出来 .有一个非常细节的地方:给出的矩形有N个,但是点有4*N个. 直接上代码:GRAHAM #include <cstdio> #include <iostream> #include <algorithm> #include…