摘要: 原题传送:http://poj.org/problem?id=1066 不用管“门要在墙壁中央”这个条件,直接枚举每个分割区间的中点为进入点,然后再求该进入点与藏宝点的线段与所有线段的最少交点数(不管路线怎么折,这个贪心策略都是正确的)。注意n=0的情况,注意线段相交精度(去除在端点相交的情况)。View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <algorithm> 4 #include <vector> 5 #define eps 1e-10 6 using nam 阅读全文
posted @ 2012-10-20 21:02 芒果布丁 阅读(153) 评论(0) 推荐(0)
摘要: 原题链接:http://poj.org/problem?id=2653 线段相交。 从后往前筛TLE,从前往后却AC了,数据坑爹。View Code 1 #include <cstdio> 2 #define maxn 100005 3 const double eps = 1e-8; 4 struct segment 5 { 6 double x1, y1, x2, y2; 7 }seg[maxn]; 8 9 double min(double a, double b)10 {11 return a < b ? a : b;12 }13 14 double max... 阅读全文
posted @ 2012-10-20 18:25 芒果布丁 阅读(150) 评论(0) 推荐(0)