有技巧的暴力过了View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;#define eps 10e-8#define inf 1<<29struct point{ double x, y;};struct seg{ point a, b;}s[100002];bool vis[100003];int ans[100003];int n;double cross(point p0, poin Read More
posted @ 2012-08-16 21:57
To be an ACMan
Views(161)
Comments(0)
Diggs(0)
构建模型非常重要。建图:把起点,终点,每个墙上的4个点分别看成图的顶点;把这些点中各对点连起来,如果与墙相交(判断两线段相交)则不连,然后floyd暴力一下。思路想到了就蛮清晰的,但我刚学计算几何,一直很纠结点写成结构体还是分开来写,调用的时候哪个比较方便,总觉得2个都很麻烦,诶,所以荒废了比较多的时间,以后不能这么2了。然后我把2种都写了一遍,写计算几何一定要注意规范。代码1:(函数调入点用double)View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algo Read More
posted @ 2012-08-16 19:02
To be an ACMan
Views(406)
Comments(0)
Diggs(0)