模板
muyu__
这个作者很懒,什么都没留下…
展开
-
【模板】树状数组
POJ 3468题意:长度为n的序列,q次操作,C l,r,x表示区间 l~r 增加x,Q l,r表示求区间 l~r 的和。#include<iostream>#include<cstdio>#include<cstring>using namespace std;const long long maxn=1e6+10;long long a...原创 2019-08-14 17:28:47 · 95 阅读 · 0 评论 -
【模板】Floyd的优化
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int dp[105][105];int main(){ int n,m; scanf("%d%d",&n,&m); memset(dp,63,sizeof(dp));...原创 2019-08-24 17:08:39 · 335 阅读 · 0 评论 -
【模板】超级幂(欧拉降幂)
题意:求a ^ a ^ a ^ a…(b次)对mod取模#include<iostream>#include<cstdio>#include<cstring>using namespace std;long long phi(long long x){ long long res=x; for(long long i=2;i*i&l...原创 2019-09-02 21:06:27 · 1646 阅读 · 0 评论 -
【模板】中国剩余定理解同余方程(附_int128)
//问题:求解同余方程组// x ≡ a1 (mod b1)// x ≡ a2 (mod b2)// x ≡ a3 (mod b3)// ······// x ≡ an (mod bn)//其中b1,b2,b3,······ bn 为不一定两两互质的整数,求x的最小非负整数//模板#include<bits/stdc++.h>#define up(i, x, y)...原创 2019-09-09 18:46:53 · 398 阅读 · 0 评论 -
【模板】KMP
/*判断字符串b是否是a的字串*/#include<bits/stdc++.h>using namespace std;void GetNext(const char *p, int *next){ next[0] = -1; next[1] = 0; int j = 1; int k = 0; int lenp = strlen(p); while (j +...原创 2019-09-09 19:01:40 · 132 阅读 · 0 评论