标程
SSL_MYD
这个作者很懒,什么都没留下…
展开
-
标程_字符串算法
标程_字符串算法Hash一维hash用一个数表示一个字符串或一个数组看做一个n进制数转换chen二维hashhash表(动态)hash静态KMPTrieAC自动机原创 2021-06-09 22:33:45 · 83 阅读 · 0 评论 -
标程_哈夫曼树(堆优化)
标程_哈夫曼树(堆优化)#include<iostream>#include<cstdio>#include<queue>using namespace std;char ans[2010]="";struct tree{int s,l,r;}a[2010];//s权值,l左子树地址,r右子树地址struct jgt{int s;};bool operator < (const jgt &t1 ,const jgt &t2){retu原创 2021-03-26 20:46:27 · 275 阅读 · 0 评论 -
标程_图论
标程_图论图的遍历深搜+邻接矩阵#include<iostream>#include<cstdio>#include<cstring>using namespace std;int n,sum;bool a[110][110],b[110];void DFS(int dep){ int i; b[dep]=0; sum++; for(i=1;i<=n;i++) if(b[i]&&a[dep][i]) DFS(i)原创 2021-03-26 19:24:24 · 316 阅读 · 0 评论 -
标程_哈希HASH
标程_哈希HASH#include<iostream>#include<cstdio>using namespace std;int HASH(int x){ return x%p;}int locate(int x){ int i,w=HASH(x); for(i=0;i<s&&hash[(w+i)%p]!=0&&hash[(w+i)%p]!=x;i++); return (w+i)%p;}void insert(i原创 2021-03-20 16:18:40 · 63 阅读 · 0 评论 -
标程_并查集
标程_并查集#include<iostream>#include<cstdio>using namespace std;int n,m,p,f[50010];void makenull()//初始化 { for(int i=1;i<=n;f[i]=i,i++); return;}int find(int x)//找代表值 { if(x==f[x])return x; return f[x]=find(f[x]);}void merge(int x,原创 2021-03-20 16:16:46 · 56 阅读 · 0 评论 -
标程_高精度运算
标程_高精度运算高精加高精#include<iostream>#include<cstdio>#include<string> #include<cstring> using namespace std;string s1,s2;int a[1010],b[1010],c[1010],len1,len2,alen,blen,clen,llen,s;void in_(){ int i,j; memset(a,0,sizeof(a));原创 2021-03-20 16:15:19 · 117 阅读 · 0 评论 -
标程_输入输出
标程_输入输出quick_read_write#include<iostream>#include<cstdio>using namespace std;int read(){ int rel,c; for(c=getchar();c<'0'||c>'9';c=getchar()); for(rel=c-'0',c=getchar();c>='0'&&c<='9';rel=(rel<<3)+(rel<<原创 2021-03-20 16:06:50 · 60 阅读 · 0 评论 -
标程_堆
标程_堆大根堆#include<iostream>#include<cstdio>using namespace std;const int maxlenth=0;class heapmx{ private: int h[maxlenth],len; void up(int x);//上移操作,把h[x]上移的合适位置 void down(int x);//下移操作,把h[x]下移的合适位置 public: void swap(int &t1原创 2021-03-20 08:39:50 · 68 阅读 · 0 评论