POJ 1244 Slots of Fun(计算几何)】的更多相关文章

题目链接 很简单的一题,数据 很小,直接暴力的.但是也是写也好久,有几个数,没算好...一次CE,一次PE,3Y. #include <iostream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> using namespace std; #define eps 1e-8 #define zero(x) (((x) > 0?(x):-(x…
Area Time Limit: 1000MS Memory Limit: 10000K Description You are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate system. From this vertex, you may go step by step to the fol…
题意: 在墙上钉两块木板,问能装多少水.即两条线段所夹的中间开口向上的面积(到短板的水平线截止) 解法: 如图: 先看是否相交,不相交肯定不行,然后就要求出P与A,B / C,D中谁形成的向量是指向上方的. 然后求出y值比较小的,建一条水平线,求出与另一条的交点,然后求面积. 要注意的是: 这种情况是不能装水的,要判掉. 还有 交G++会WA, 交C++就可以了, 不知道是POJ的问题还是 G++/C++的问题. 代码: #include <iostream> #include <cst…
题意:给出一个100*100的正方形区域,通过若干连接区域边界的线段将正方形区域分割为多个不规则多边形小区域,然后给出宝藏位置,要求从区域外部开辟到宝藏所在位置的一条路径,使得开辟路径所需要打通的墙壁数最少("打通一堵墙"即在墙壁所在线段中间位置开一空间以连通外界),输出应打通墙壁的个数(包括边界上墙壁).题解:枚举每一个入口,在所有的情况中取穿墙数最少的输出即可,枚举每一个入口的时候,并不用枚举每条边的中间点,直接枚举该线段的两个顶点就行(因为要经过一个墙,那么从线段的任意地方进去都…
Toy Storage Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3146   Accepted: 1798 Description Mom 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…
Segments Time Limit: 1000MS Memory Limit: 65536K 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…
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…
Beauty Contest Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 26180   Accepted: 8081 Description Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bess…
[题目链接] http://poj.org/problem?id=1127 [题目大意] 在二维平面中,给出一些木棍的左右端点,当木棍相交或者间接相交时 我们判断其连通,给出一些询问,问某两个木棍是否连通 [题解] 我们首先记录直接相连的木棍,然后对图跑一遍floyd算法,就能预处理出所有答案. [代码] #include <cstdio> #include <algorithm> #include <cmath> #include <cstring> us…
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…