上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 18 下一页
一定要注意 总的点数 n<= 2 时 graham不适用。还要注意 graham找到凸包后 注意 top <=2 时面积为0。View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;struct point{ double x, y;}p[10003];double det(double x1, double y1, double x2, double y2){ return x1 * y2 Read More
posted @ 2012-09-03 15:49 To be an ACMan Views(318) Comments(0) Diggs(0)
题意:给出一个去掉几个点后的凸包,判断剩下的几个点组成的新凸包是不是原来的那个凸包。分析:只要 新凸包的每条边上有3个或3个以上的点时,凸包就是原来那个凸包,否则凸包不是原来那个凸包。 很好理解的,不是很难想到。View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;#define eps 1e-8struct point{ int x, y;}p[1003];int det(int x1, int y1 Read More
posted @ 2012-09-02 22:20 To be an ACMan Views(208) Comments(0) Diggs(0)
RT,注意考虑凸包点数小于3的情况View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<math.h>using namespace std;#define eps 1e-8#define inf 1<<29struct point{ int x, y; point(){} point(int xx, int yy) : x(xx), y(yy){}};struct data{ int x, y, v, l;}d[16];int det(int Read More
posted @ 2012-09-01 20:21 To be an ACMan Views(236) Comments(0) Diggs(0)
题意:给你一些点,这些点里面一定有(0,0)原点,并且没有第二象限中的点,这些点是一个凸包,让你按极角序输出这些点。就排序,比较水,没凸包真扫兴View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<math.h>using namespace std;#define eps 1e-8#define inf 1<<29struct point{ int x, y;}p[52];int det(int x1, int y1, int x2, int Read More
posted @ 2012-09-01 15:37 To be an ACMan Views(341) Comments(0) Diggs(0)
题意:国王想建一个周长最短的城墙,使墙的任意一点到城墙的距离都 > l。求这面墙的周长。不难发现题目要求的就是 凸包的周长+半径为l圆的周长。不清楚Graham-scan算法的两种排序概念的可以去看看lrj的黑书,黑书介绍了两种排序方法来实现Graham-scan算法。1. 极角序 (看了lrj的黑书就知道这个排序不能解决某些共线问题,有一定的缺陷,但这题反映不出它的缺陷)View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<math.h>using Read More
posted @ 2012-09-01 14:42 To be an ACMan Views(1500) Comments(0) Diggs(0)
题意:从一条线段(property)上观察另一与之平行的线段(house),其中有很多与它们都平行的线段(障碍物),求在property得可见整条线段house的最长连续范围的长度。类别:直线交思路:求出线段house对于每条障碍物在线段property在的最大投影,投影即为在线段property上,被这条障碍物遮蔽,而无法看见整条线段house的范围。然后求出线段property上没有被投影到的最长的连续区间长度即为所求答案。另外,要注意先排除掉位置不是在house和property之间的障碍物。View Code #include<stdio.h>#include<str Read More
posted @ 2012-08-31 14:27 To be an ACMan Views(197) Comments(0) Diggs(0)
还不错的一道题目,要注意看清题意。注意:1. 普通行驶的情况下,每通过1段赛道,可以获得20%的能量(N2O). 所以加速情况不加能量2. 能量集满后获得一个加速卡(同时能量清0). 加速卡最多可以储存2个,也就是说当你有2个加速卡而能量再次集满,那么能量清零但得不到加速卡。看清题目的话, 这题状态转移推一下,不是很难。View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define inf 1<<29int n, l;int d Read More
posted @ 2012-08-26 16:13 To be an ACMan Views(426) Comments(0) Diggs(0)
第一次遇到20s的题,果断暴力,贡献多个TLE, 水题也不是完全水的,必须要适当的优化一下,学习了。View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define lld __int64lld gcd(lld a, lld b) //最大公约数 { return a ? gcd(b%a, a) : b; }int n, k;int a[802];bool vis[802];int main(){ int i, j; while( ~scan Read More
posted @ 2012-08-25 22:45 To be an ACMan Views(254) Comments(0) Diggs(0)
题意:给出一个长度为N(N <= 100000)的数列,然后是两种操作:U A B: 将第A个数替换为B (下标从零开始)Q A B: 输出区间[A, B]的最长连续递增子序列询问的次数m <= 100000。类型:区间合并这题跟POJ hotel差不多,这题应该比hotel简单一些,因为 update是单点更新,所以每次更新数据都是更新到低的,所以不用写pushdown函数,pushup里面比hotel多了一个判断,即num[m] < num[m]时左右儿子的数据才能合并,否则不合并,其它跟hotel无差。View Code #include<stdio.h># Read More
posted @ 2012-08-24 15:58 To be an ACMan Views(399) Comments(0) Diggs(0)
#include<set>#include<map>#include<string>#include<vector>#include<iostream>#include<algorithm>using namespace std;int main(){ vector<int> V; /*for(int i=10;i>=0;i--) { V.push_back(i); V.push_back(i); } int size=V.size(); for(int i=0;i<size;i++) { prin Read More
posted @ 2012-08-24 12:19 To be an ACMan Views(907) Comments(0) Diggs(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 18 下一页