
【Algorithm】各种模板
Thereisnospon
在校本科生,渣渣一枚,正在向成为一名大牛而努力~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
高进度乘法FFT优化
#include #include #include #include #include #include #include #include #include using namespace std;#define L(x) (1 << (x))const double PI = acos(-1.0);const int Maxn = 133015;double ax[转载 2015-08-19 08:25:31 · 660 阅读 · 0 评论 -
字典树模板
#include#include#include#includeusing namespace std;#define MAX 26const char CH='a';struct Node{ int nCount; Node * Next[MAX];};Node Memory[100000];struct Trie{ Node * root;原创 2015-11-14 10:43:04 · 339 阅读 · 0 评论 -
c++ STL set 使用
set 集合容器 实现了红黑树的平衡二叉检索树的数据结构,插入元素时,它会自动调整二叉树的排列,把元素放到适当的位置,以保证每个子树根节点键值大于左子树所有节点的键值,小于右子树所有节点的键值;另外,还得保证根节点左子树的高度与右子树高度相等。 平衡二叉检索树使用中序遍历算法,检索效率高于vector、deque和list等容器,另外使用中序遍历可将键值按照从小到大遍历出来。原创 2015-11-20 17:24:03 · 371 阅读 · 0 评论 -
二分图匹配模板
#include#include#include#define MAX 1005using namespace std;int mmap[MAX][MAX];int link[MAX];int vis[MAX];int n,m;bool dfs(int l){ for(int r=0;r<m;r++) { if(mmap[l][r]&&!vis[原创 2015-11-24 20:07:27 · 412 阅读 · 0 评论 -
归并树 划分树 模板
归并树#include #include #include #include #include #include #include #include #include #include #define MID(x,y) ( ( x + y ) >> 1 )#define L(x) ( x << 1 )#define R(x) ( x << 1 | 1 )#define原创 2015-11-19 12:13:52 · 384 阅读 · 0 评论 -
素数筛法模板
#include#include#include#include#includeusing namespace std;const int L=1000005,inf=1<<30,maxn=1005;int prime[L];bool is[L];void getPrime(){ fill(is,is+L,1); is[1]=0; int np=0;原创 2015-11-19 11:58:12 · 407 阅读 · 0 评论 -
c++ STL map 使用
#include#includeusing namespace std;typedef map::iterator It;//迭代器类型typedef pair Value;//数据类型int main(){ string key; int value; //创建map mapmp; //插入数据 mp.insert(Value("b",原创 2015-11-20 16:50:53 · 438 阅读 · 0 评论