POJ 2540 Hotter Colder(半平面交)】的更多相关文章

/* poj 2540 Hotter Colder 切割多边形 用两点的中垂线切割多边形,根据冷热来判断要哪一半 然后输出面积 */ #include <stdio.h> #include<math.h> const double eps=1e-8; const int N=200; struct point { double x,y; point(){} point(double a,double b):x(a),y(b){} }dian[N]; point jiao[N]; i…
Description The children's game Hotter Colder is played as follows. Player A leaves the room while player B hides an object somewhere in the room. Player A re-enters at position (0,0) and then visits various other positions about the room. When playe…
题意: 一个(0,0)到(10,10)的矩形,目标点不定,从(0,0)开始走,如果走到新一点是"Hotter",那么意思是离目标点近了,如果是"Colder“,那么就是远了,"Same"是相同.要你推测目标点的可能位置的面积. 解法:半平面交水题.从一个点到另一个点远了,说明目标点在两点之间连线的中垂线的离源点较近的一侧,即我们每次都可以得到一条直线来切割平面,要么切割左侧,要么切割右侧,要么都切,再求一个半平面交就可以得出可能面积了. 代码: #incl…
http://poj.org/problem?id=2540 题意:给你每次行走的路径,而且告诉你每次离一个点光源是远了还是近了,要求每次光源可能存在的位置的面积. 思路:如果出现"same",说明光源在中垂线上,面积为0,否则我们考虑远了或者近了,实际上就是在路径中两点连成直线的中垂线就是半平面直线,近了在这条直线的远侧,远了在这条直线的近侧. #include<cstdio> #include<iostream> #include<cmath>…
Art Gallery Time Limit: 1000MS Memory Limit: 10000K Description The art galleries of the new and very futuristic building of the Center for Balkan Cooperation have the form of polygons (not necessarily convex). When a big exhibition is organized, wat…
LINK 题意:给出一个多边形,求是否存在核. 思路:比较裸的题,要注意的是求系数和交点时的x和y坐标不要搞混...判断核的顶点数是否大于1就行了 /** @Date : 2017-07-20 19:55:49 * @FileName: POJ 3335 半平面交求核.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$…
http://poj.org/problem?id=1474 解法同POJ 1279 A一送一 缺点是还是O(n^2) ...nlogn的过几天补上... /********************* Template ************************/ #include <set> #include <map> #include <list> #include <cmath> #include <ctime> #include…
http://poj.org/problem?id=1279 顺时针给你一个多边形...求能看到所有点的面积...用半平面对所有边取交即可,模版题 这里的半平面交是O(n^2)的算法...比较逗比...暴力对每条线段做半平面交...要注意的地方写在注释里了...顺序写反了卡了我好久 /********************* Template ************************/ #include <set> #include <map> #include <…
第一道半平面交,只会写N^2. 将每条边化作一个不等式,ax+by+c>0,所以要固定顺序,方便求解. 半平面交其实就是对一系列的不等式组进行求解可行解. 如果某点在直线右侧,说明那个点在区域内,否则出现在左边,就可能会有交点,将交点求出加入. //#pragma comment(linker, "/STACK:16777216") //for c++ Compiler #include <stdio.h> #include <iostream> #inc…
Triathlon Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4733   Accepted: 1166 Description Triathlon is an athletic contest consisting of three consecutive sections that should be completed as fast as possible as a whole. The first sect…