- 博客(4)
- 收藏
- 关注
原创 快速幂模板
本来想顺便把矩阵快速幂顺便也贴上来的 有时间在搞吧 这里是快速幂的题目链接 #include<cstdio> #include<iostream> using namespace std; long long a,b,c; long long pow3(long long a,long long b) { long long ans=1; while(b!=0)//最后...
2019-10-19 23:58:05
128
原创 最小生成树模板及注意的问题
给总是打不对的那个你(笑哭) #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> using namespace std; const int N=2e5+5;//边的个数 int n,x,k,y,z,m,ans,tot,fa[N]; struct nod...
2019-10-19 23:48:40
171
原创 乘法逆元模板
先贴代码 #include #include #include #include using namespace std; const int N=3e6+6; long long n,p,inv[N]; int main() { scanf("%lld %lld",&n,&p); inv[1]=1; inv[0]=0; for(int i=2;i<=n;i++) { inv...
2019-10-15 23:01:19
214
原创 素数线性筛模板
#include #include #include using namespace std; const int N=1e7+5; int n,m,a[N],k,use[N],x; void pd() { use[1]=1; for(int i=2;i<=n;i++) { if(use[i]==0); a[++k]=i; for(int j=1;j<=k&&ia[j]...
2019-10-15 22:58:07
235
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人