poj 1873】的更多相关文章

The Fortified Forest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6198   Accepted: 1744 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…
题链: http://poj.org/problem?id=1873 题解: 计算几何,凸包 枚举被砍的树的集合.求出剩下点的凸包.然后判断即可. 代码: #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int MAXN=16,INF=0x3f3f3f3f; co…
题意:二维平面有一堆点,每个点有价值v和删掉这个点能得到的长度l,问你删掉最少的价值能把剩余点围起来,价值一样求删掉的点最少 思路:n<=15,那么直接遍历2^15,判断每种情况.这里要优化一下,如果价值比当前最优大了continue.POJ的G++输出要用%f...orz,还是乖乖用C++... 代码: #include<set> #include<map> #include<stack> #include<cmath> #include<qu…
通过这道题发现了原来写凸包的一些不注意之处和一些错误..有些错误很要命.. 这题 N = 15 1 << 15 = 32768 直接枚举完全可行 卡在异常情况判断上很久,只有 顶点数 >= 2,即 n >= 3 时凸包才有意义 顶点数为 1 时,tmp = - 1 要做特殊判断. 总结了一下凸包模板 //template Convex Hull friend bool operator < (const point &p1, const point &p2){…
题目传送门 题意:砍掉一些树,用它们做成篱笆把剩余的树围起来,问最小价值 分析:数据量不大,考虑状态压缩暴力枚举,求凸包以及计算凸包长度.虽说是水题,毕竟是final,自己状压的最大情况写错了,而且忘记特判凸包点数 <= 1的情况. /************************************************ * Author :Running_Time * Created Time :2015/11/3 星期二 16:10:17 * File Name :POJ_1873…
题目大意:有个国王他有一片森林,现在他想从这个森林里面砍伐一些树木做成篱笆把剩下的树木围起来,已知每个树都有不同的价值还有高度,求出来砍掉那些树可以做成篱笆把剩余的树都围起来,要使砍伐的树木的价值最小,如果有价值相同的尽量使砍伐的树木少一些. 分析:因为树木的数量是比较少的,所以枚举所有的状态,判断那个树需要砍那个树不需要,然后按照要求求出来答案即可. 代码如下: ==================================================================…
题意:是有n棵树,每棵的坐标,价值和长度已知,要砍掉若干根,用他们围住其他树,问损失价值最小的情况下又要长度足够围住其他树,砍掉哪些树.. 思路:先求要砍掉的哪些树,在求剩下的树求凸包,在判是否可行.(枚举+凸包) // Time 407ms; Memory 200K #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring>…
The Fortified Forest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6400   Accepted: 1808 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…
哇实验室里正在吵架,爽死了! wf水题.显然二进制枚举,注意剪枝,val>ans的时候剪一下,不然会tle.然后就没惹. 我老人家一开始写了个 感觉非常垃圾,wa了一发又t了一发. 感觉自己可以退役了 #include <cstdio> #include <cstring> #include <cmath> #include <iostream> #include <iomanip> #include <algorithm> #…
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…