poj1873(枚举+凸包)】的更多相关文章

The Fortified Forest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7291   Accepted: 2031 Description Once upon a time, in a faraway land, there lived a king. This king owned a small collection of rare and valuable trees, which had been…
Description Once upon a time, in a faraway land, there lived a king. This king owned a small collection of rare and valuable trees, which had been gathered by his ancestors on their travels. To protect his trees from thieves, the king ordered that a…
题目大意是让你用这n条边放在网格上构成凸包,并且边的两端点必须在网格上. 那么比较容易想到的就是枚举可能情况,因为这样的勾股数组成情况不多,因此可以直接枚举所有连出去的边反映在坐标轴上的所有情况,最后判断是否回到起点并且绕城一个凸包. 但是样例三每条边有最多36个方向,那么366*6!显然会超时,我们就需要一些剪枝. 1.第一条边固定住,那么我们的枚举边的顺序的复杂度变成了5!. 2.枚举到最后一个点的时候,不需要再将次边连出去判断是否回到起点,直接判断起点到该点的距离是否为这条边的长度即可,复…
通过这道题发现了原来写凸包的一些不注意之处和一些错误..有些错误很要命.. 这题 N = 15 1 << 15 = 32768 直接枚举完全可行 卡在异常情况判断上很久,只有 顶点数 >= 2,即 n >= 3 时凸包才有意义 顶点数为 1 时,tmp = - 1 要做特殊判断. 总结了一下凸包模板 //template Convex Hull friend bool operator < (const point &p1, const point &p2){…
Problem Description Josh Lyman is a gifted painter. One of his great works is a glass painting. He creates some well-designed lines on one side of a thick and polygonal glass, and renders it by some special dyes. The most fantastic thing is that it c…
题目链接:http://poj.org/problem?id=2187 旋转卡壳算法:http://www.cppblog.com/staryjy/archive/2009/11/19/101412.html 或 http://cgm.cs.mcgill.ca/~orm/rotcal.frame.html #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #includ…
称号: Maple trees Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 177 Accepted Submission(s): 63   Problem Description There are a lot of trees in HDU. Kiki want to surround all the trees with the m…
题目描述 近来A国和B国的矛盾激化,为了预防不测,A国准备修建一条长长的防线,当然修建防线的话,肯定要把需要保护的城市修在防线内部了.可是A国上层现在还犹豫不决,到底该把哪些城市作为保护对象呢?又由于A国的经费有限,所以希望你能帮忙完成如下的一个任务: 1.给出你所有的A国城市坐标 2.A国上层经过讨论,考虑到经济问题,决定取消对i城市的保护,也就是说i城市不需要在防线内了 3.A国上层询问对于剩下要保护的城市,修建防线的总经费最少是多少 你需要对每次询问作出回答.注意单位1长度的防线花费为1.…
题目链接:http://poj.org/problem?id=2187 Time Limit: 3000MS Memory Limit: 65536K 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, Bessie will make a tour of…
大致题意: 给出一个多边形,问你有多少种放法可以使得多边形稳定得立在平面上. 先对多边形求重心,在求凸包,枚举凸包的边,如果重心没有在边的范围内,则不行 判断是否在范围内可用点积来判断 #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #include<queue> #include<set> #include<map> #i…