2017年3月6日

矩阵快速幂

摘要: #include <cstdio> #include<cstring> #define SMod 1000000007 #define LL long long using namespace std; int n; LL k; struct Matrix { LL m[103][103]; Mat 阅读全文

posted @ 2017-03-06 21:46 bennetts 阅读(95) 评论(0) 推荐(0) 编辑

ios::sync_with_stdio(false)副作用

摘要: #include #include using namespace std; string a,b; inline int in(){ int ans=0; char x=getchar(); while(x'9')x=getchar(); while(x>='0'&&x>a>>b; cout<<a<<endl<<b<<endl; int c,d; c=in();d=in(); co... 阅读全文

posted @ 2017-03-06 20:50 bennetts 阅读(242) 评论(1) 推荐(0) 编辑

并查集模板

摘要: 转载于:http://www.tuicool.com/articles/Zb2qYzj 并查集有两个优化。 一、按秩合并 描述:就是在对两个不同子集连接时,按照rank来连,也就是rank低的连在rank高的下面。rank高的做父亲节点。 作用,这样类似维护了一棵树,树是rank高的在上。rank为 阅读全文

posted @ 2017-03-06 20:03 bennetts 阅读(809) 评论(0) 推荐(0) 编辑

快排模板

摘要: #include<iostream> #include<cstdio> #include<cmath> using namespace std; void quicksort(int a[],int left,int right) { int i,j,base; i=left; j=right; b 阅读全文

posted @ 2017-03-06 19:38 bennetts 阅读(240) 评论(0) 推荐(0) 编辑

导航