摘要: 题目链接:http://poj.org/problem?id=2096 f[i][j]表示从当前状态到目标状态的期望。。。 1 //STATUS:C++_AC_188MS_8076KB 2 #include 3 #include 4 #include 5 //#include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include 16 #include 17 #include 18 #include... 阅读全文
posted @ 2013-07-19 20:20 zhsl 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 转自:http://blog.csdn.net/shahdza/article/details/6317011①//适用于正整数 template inline void scan_d(T &ret) { char c; ret=0; while((c=getchar())'9'); while(c>='0'&&c inline bool scan_d(T &ret) { char c; int sgn; if(c=getchar(),c==EOF) return 0; //EOF while(c!='-'& 阅读全文
posted @ 2013-07-19 01:14 zhsl 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3468 以前用线段树做过,现在用Splay Tree A了,向HH、kuangbin、cxlove大牛学习了各种Splay各种操作,,,Orz。。 Splay Tree的区间操作和线段树的操作差不多,也是保存子树的值,然后懒惰操作,在Rotate()最后维护节点信息的时候,只要Push_Up(y)的,因为x还需要网上旋转到根节点,最后更新下就可以了,并且在下一次Rotate()的时候,还会Push_Down(x)的信息,因此不能Push_Up(x)。 1 //STATUS:C++_AC_3407MS_3696KB 2 ... 阅读全文
posted @ 2013-07-19 00:53 zhsl 阅读(260) 评论(0) 推荐(0) 编辑