摘要: 对于组合游戏的题;首先把问题建模成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) 编辑
摘要: 简单的计算几何;可以把0-2*pi分成几千份,然后找出最小的;也可以用三分; 1 #include 2 #include 3 #include 4 #define pi acos(-1) 5 #define eps 1e-6 6 using namespace std; 7 8 struct node 9 {10 double x,y;11 node(double x=0,double y=0):x(x),y(y){ }12 bool operator0)return length(v3);40 else return fabs(cross(v1,v2))/l... 阅读全文
posted @ 2013-11-01 21:01 Yours1103 阅读(130) 评论(0) 推荐(0) 编辑
摘要: splay的题;学习白书上和网上的代码敲的; 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int n,m; 7 struct node 8 { 9 node *ch[2]; 10 int s,v; 11 int flip; 12 node(int v):v(v) 13 { 14 ch[1]=ch[0]=NULL; 15 s=1; 16 flip=0; 17 } 18 voi... 阅读全文
posted @ 2013-11-01 18:58 Yours1103 阅读(187) 评论(0) 推荐(0) 编辑