上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 26 下一页
摘要: 半平面的交,二分的方法; 1 #include 2 #include 3 #include 4 #define eps 1e-6 5 using namespace std; 6 7 int dcmp(double x) 8 { 9 return fabs(x) 0 ? 1 : -1); 10 } 11 12 struct Point 13 { 14 double x; 15 double y; 16 Point(double x = 0, double y = 0):x(x), y(y) {} 17 }; 18 typedef Poin... 阅读全文
posted @ 2013-11-05 13:13 Yours1103 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 组合游戏题;组合游戏的规则:1.必败态的所有后继都是必胜态;2.必胜态最少有一个必败的后继;这里的必胜态是f[1][0][0][0];其中f[a][b][c][d]表示有a个1,b个2,c个3,d个4是不是一个必胜态;可以认为大于3的奇数等同于3,大于4的偶数等同于4.然后递归求解; 1 #include 2 using namespace std; 3 4 bool vis[51][51][51][51]; 5 bool f[51][51][51][51]; 6 int F(int a,int b,int c,int d) 7 { 8 if (!vis[a][b][c][d]) ... 阅读全文
posted @ 2013-11-04 21:08 Yours1103 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 旋转卡壳算法;直接在这个上面粘的模板主要用途:用于求凸包的直径、宽度,两个不相交凸包间的最大距离和最小距离···这题就是求凸包的直径 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define eps 1e-9 7 using namespace std; 8 const double pi = acos(-1); 9 10 int dcmp(double x) 11 { 12 return fabs(x) 0 ? 1 : -1); 13 } 14 15 struct Point 1... 阅读全文
posted @ 2013-11-04 20:17 Yours1103 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 当退化成点和线段的时候,可以不进行特判;因为这种情况已经包括进条件1.2里面了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define eps 1e-9 7 using namespace std; 8 const double pi = acos(-1); 9 10 int dcmp(double x) 11 { 12 return fabs(x) 0 ? 1 : -1); 13 } 14 15 struct Point 16 { 17 double x; 18 ... 阅读全文
posted @ 2013-11-04 19:50 Yours1103 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 凸包+一点直线的知识; 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define eps 1e-9 7 using namespace std; 8 const double pi = acos(-1); 9 10 int dcmp(double x) 11 { 12 return fabs(x) 0 ? 1 : -1); 13 } 14 15 struct Point 16 { 17 double x; 18 double y; 19 20 Point(... 阅读全文
posted @ 2013-11-04 16:24 Yours1103 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 主要是凸包的应用; 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define eps 1e-9 7 using namespace std; 8 const double pi = acos(-1); 9 10 int dcmp(double x) 11 { 12 return fabs(x) 0 ? 1 : -1); 13 } 14 15 struct Point 16 { 17 double x; 18 double y; 19 20 Point(do... 阅读全文
posted @ 2013-11-04 15:34 Yours1103 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 这个题目的方法是将圆盘分成一个个圆环,然后判断这些圆环是否被上面的圆覆盖;如果这个圆的圆周上的圆弧都被上面的覆盖,暂时把它标记为不可见;然后如果他的头上有个圆,他有个圆弧可见,那么他自己本身可见,并且可以把这条圆弧下面的第一个圆重新标记为可见;另外,圆弧可见还是不可见利用它的中点来进行判断; 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 const int maxn = 100 + 10; 10 const double eps = 1e-1... 阅读全文
posted @ 2013-11-04 15:04 Yours1103 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 简单的线段树的题;有两种方法写这个题,目前用的熟是这种慢点的;不过不知道怎么老是T;感觉网上A过的人的时间度都好小,但他们都是用数组实现的难道是指针比数组慢?好吧,以后多用数组写写吧!超时的代码: 1 #include 2 #include 3 #include 4 #define maxn 1000009 5 using namespace std; 6 7 struct node 8 { 9 int l,r; 10 int ma,mi,sum; 11 int ad,st; 12 bool flag1,flag2; 13 node ... 阅读全文
posted @ 2013-11-02 17:10 Yours1103 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 又是一道线段树区间更新的题; 1 #include 2 #include 3 #include 4 #define ll long long 5 #define maxn 500005 6 using namespace std; 7 ll sum[maxn]; 8 struct tree 9 { 10 int l,r; 11 int ml,mr; 12 int pre,suf; 13 tree *left,*right; 14 } tr[maxn*2]; 15 16 int trcount; 17 18 void build(tree *... 阅读全文
posted @ 2013-11-02 12:05 Yours1103 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 对于组合游戏的题;首先把问题建模成NIM等经典的组合游戏模型;然后打表找出,或者推出SG函数值;最后再利用SG定理判断是否必胜必败状态; 1 #include 2 #define ll long long 3 using namespace std; 4 5 ll sg(ll x) 6 { 7 return x%2==0 ? x/2 : sg(x/2); 8 } 9 10 int main()11 {12 int t;13 scanf("%d",&t);14 while(t--)15 {16 int n;17 ll a,... 阅读全文
posted @ 2013-11-01 23:17 Yours1103 阅读(228) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 26 下一页