![](https://img-blog.csdnimg.cn/20190927151026427.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
ACM模板
四处搜集的板子
康宇
这个作者很懒,什么都没留下…
展开
-
__int128读写模板
inline __int128 read(){ __int128 x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=x*10+ch-'0'; ch=getchar();转载 2020-09-21 10:16:10 · 146 阅读 · 0 评论 -
求十亿内所有素数之和与个数
求十亿内所有质数的和,怎么做最快? - PlanarG的回答 - 知乎 Min25筛实现,大约每100ms算一个 const int N = 1e6 + 10;//对应素数精度可以到1e10 typedef __int128 LL;//防止1e10 * 1e10爆long long namespace Min25 { int prime[N], id1[N], id2[N], flag[N], ncnt, m; LL g[N], sum[N], a[N], T, n; i转载 2020-09-21 10:08:55 · 530 阅读 · 0 评论 -
后缀数组 模板
原文地址:https://www.cnblogs.com/zwfymqz/p/8413523.html #include<cstdio> #include<cstring> #include<algorithm> const int MAXN = 1e6 + 10; using namespace std; int N, M, rak[MAXN], sa[MAXN], tax[MAXN], tp[MAXN]; void Debug() { printf("****转载 2020-07-14 11:20:43 · 131 阅读 · 0 评论 -
codevs 1080 线段树模板
省赛完了,回来补课 这线段树好像比我原先所想的要简单的多OTZ #include <cstring> #include <iostream> #include <cstdio> using namespace std; const int maxn=200000+10; typedef long long ll; ll a[maxn]; ll sum[maxn*...原创 2019-05-15 20:30:26 · 113 阅读 · 0 评论 -
数论板子集
威尔逊定理: p为素数,则p∣(p−1)!+1p\mid(p-1)!+1p∣(p−1)!+1,则(p−2)!≡1(mod p)(p-2)!\equiv1(mod\ p)(p−2)!≡1(mod p) 欧拉定理: p,a互素,则aϕ(p)≡1(mod p)a^{\phi(p)}\equiv1(mod\ p)aϕ(p)≡1(mod p) 费马小定理: p为素数,则ap≡a(mod p)a^p\equiv a(mod\ p)ap≡a(mod p) 推论原创 2020-05-21 11:17:35 · 188 阅读 · 0 评论 -
HDU6579 Operation (线性基+前缀和)
Descrpiton There is an integer sequence a of length n and there are two kinds of operations: 0 l r: select some numbers from al…ar so that their xor sum is maximum, and print the maximum value. 1 x: append x to the end of the sequence and let n=n+1 . Input原创 2020-05-13 22:15:47 · 214 阅读 · 0 评论