数论模板
ANDX
bright future
展开
-
Lucas模板
LL qpow(LL a, LL times, LL mod){ LL res = 1; LL tmp = a; while (times) { if (times & 1) res = res * tmp % mod; tmp = tmp * tmp % mod; times >>= 1; } return res;}LL F(LL n, LL m...原创 2020-02-17 17:31:39 · 290 阅读 · 0 评论 -
Lucas
typedef long long LL;LL qpow(LL a, LL times, LL mod){ LL res = 1; LL tmp = a; while (times) { if (times & 1) res = res * tmp % mod; tmp = tmp * tmp % mod; times >>= 1; } return ...原创 2020-02-06 19:40:35 · 90 阅读 · 0 评论 -
数论模板
数论原创 2019-08-09 16:42:55 · 95 阅读 · 0 评论 -
excrt and crt
excrt#include<iostream>#include<cstdio>#define LL long long//溢出时可改为 #define LL __int128using namespace std;const LL MAXN = 1e6 + 10;LL K, C[MAXN], M[MAXN], x, y;LL gcd(LL a, LL b) {...转载 2019-09-08 21:33:22 · 119 阅读 · 0 评论 -
矩阵快速幂
#include<bits/stdc++.h>using namespace std;const int maxn=10005;struct Matrix{ int n,m; int v[maxn][maxn]; Matrix(int n,int m):n(n),m(m){} void init(){memset(v,0,sizeof v);} ...原创 2019-09-27 20:52:27 · 64 阅读 · 0 评论