上一页 1 2 3 4 5 6 7 ··· 9 下一页

2016年8月5日

c++ pb_ds库,实现 红黑树,Splay

摘要: C++ pb_ds库#include <ext/pb_ds/assoc_container.hpp>#include <ext/pb_ds/tree_policy.hpp>using namespace __gnu_pbds;定义一颗红黑树tree<int,null_type,less<int>,r 阅读全文

posted @ 2016-08-05 09:47 鱼泪儿 阅读(1335) 评论(1) 推荐(1) 编辑

2016年8月2日

Treap

摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define LL long long 9 10 using namespace std; 11 12 struct Treap_node 13 { 14 Treap_node *left,*r... 阅读全文

posted @ 2016-08-02 20:13 鱼泪儿 阅读(197) 评论(0) 推荐(0) 编辑

随机数

摘要: 1 #include 2 #include // int rand(void) 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #define LL long long 10 11 using namespace std; 12 13 //.产生随机数的用法 14 //1... 阅读全文

posted @ 2016-08-02 16:10 鱼泪儿 阅读(141) 评论(0) 推荐(0) 编辑

DLX

摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define LL long long 9 10 using namespace std; 11 12 ... 阅读全文

posted @ 2016-08-02 12:14 鱼泪儿 阅读(305) 评论(0) 推荐(0) 编辑

2016年8月1日

逆康托展开

摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define LL long long 9 10 using namespace std; 11 12 void unCantor(int X,int n) 13 { 14 int a[20],... 阅读全文

posted @ 2016-08-01 09:12 鱼泪儿 阅读(147) 评论(0) 推荐(0) 编辑

2016年7月31日

康托展开

摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define LL long long 9 10 using namespace std; 11 12 //X = a[1]*(n-1)!+a[2]*(n-2)!+...+a[i]*(n-i)!+...... 阅读全文

posted @ 2016-07-31 17:39 鱼泪儿 阅读(124) 评论(0) 推荐(0) 编辑

light oj 1427(ac自动机)

摘要: 1 #include 2 3 using namespace std; 4 5 const int N = 510*505; 6 const int M = 27; 7 8 9 mapMap; 10 struct Trie 11 { 12 int next[N][M],fail[N],end[N]; 13 int root,L... 阅读全文

posted @ 2016-07-31 15:52 鱼泪儿 阅读(166) 评论(0) 推荐(0) 编辑

hdu 2586 (lca-RMQ)

摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define LL long long 9 10 using namespace std; 11 const int N = 5e4; 12 13 int head[N],to... 阅读全文

posted @ 2016-07-31 15:02 鱼泪儿 阅读(103) 评论(0) 推荐(0) 编辑

2016年5月18日

约瑟夫问题

摘要: 这个问题其实还蛮有名的,它被称为约瑟夫的问题。 最直观的解法是用循环链表模拟报数、淘汰的过程,复杂度是O(NM)。 今天我们来学习两种更高效的算法,一种是递推,另一种也是递推。第一种递推的公式为: 接下来我们用数学归纳法来证明这个递推公式的正确性: (1) f[1] = 0 显然当只有1个候选人时, 阅读全文

posted @ 2016-05-18 15:45 鱼泪儿 阅读(202) 评论(0) 推荐(0) 编辑

Eular质数筛法

摘要: 小Hi:我们可以知道,任意一个正整数k,若k≥2,则k可以表示成若干个质数相乘的形式。Eratosthenes筛法中,在枚举k的每一个质因子时,我们都计算了一次k,从而造成了冗余。因此在改进算法中,只利用k的最小质因子去计算一次k。 首先让我们了解一下Eular筛法,其伪代码为: isPrime[] 阅读全文

posted @ 2016-05-18 12:33 鱼泪儿 阅读(313) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 9 下一页

导航