题意:二维平面有一堆点,每个点有价值v和删掉这个点能得到的长度l,问你删掉最少的价值能把剩余点围起来,价值一样求删掉的点最少 思路:n<=15,那么直接遍历2^15,判断每种情况.这里要优化一下,如果价值比当前最优大了continue.POJ的G++输出要用%f...orz,还是乖乖用C++... 代码: #include<set> #include<map> #include<stack> #include<cmath> #include<qu…
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…
题链: 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…
题意:是有n棵树,每棵的坐标,价值和长度已知,要砍掉若干根,用他们围住其他树,问损失价值最小的情况下又要长度足够围住其他树,砍掉哪些树.. 思路:先求要砍掉的哪些树,在求剩下的树求凸包,在判是否可行.(枚举+凸包) // Time 407ms; Memory 200K #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring>…
题目传送门 题意:砍掉一些树,用它们做成篱笆把剩余的树围起来,问最小价值 分析:数据量不大,考虑状态压缩暴力枚举,求凸包以及计算凸包长度.虽说是水题,毕竟是final,自己状压的最大情况写错了,而且忘记特判凸包点数 <= 1的情况. /************************************************ * Author :Running_Time * Created Time :2015/11/3 星期二 16:10:17 * File Name :POJ_1873…
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最大15,二进制枚举不会超时.枚举不被砍掉的树,然后求凸包 #include<stdio.h> #include<math.h> #include<algorithm> #include<iostream> #include <cstring> #define eps 1e-8 #define INF 1e9 using namespace std; const int MAXN = 20; struct Point { int x,y; in…
通过这道题发现了原来写凸包的一些不注意之处和一些错误..有些错误很要命.. 这题 N = 15 1 << 15 = 32768 直接枚举完全可行 卡在异常情况判断上很久,只有 顶点数 >= 2,即 n >= 3 时凸包才有意义 顶点数为 1 时,tmp = - 1 要做特殊判断. 总结了一下凸包模板 //template Convex Hull friend bool operator < (const point &p1, const point &p2){…
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…
/* poj1873 The Fortified Forest 凸包+枚举 水题 用小树林的木头给小树林围一个围墙 每棵树都有价值 求消耗价值最低的做法,输出被砍伐的树的编号和剩余的木料 若砍伐价值相同,则取砍伐数小的方案. */ #include<stdio.h> #include<math.h> #include <algorithm> #include <vector> using namespace std; const double eps = 1…