10 2023 档案
快速幂模板
摘要://快速幂 //底数128 long long ksm(__int128 a, long long b, long long p) { __int128 res = 1; while (b) { if (b & 1)res = res * a % p; b >>= 1; a = a * a % p;
求质因数模板
摘要:欧拉定理求质因数: //欧拉定理求质因数 long long phi(long long x) { long long i; long long res = x; for (i = 2; i * i <= x; i++) { if (x % i == 0) { res = res / i * (i
并查集模板
摘要:#include <bits/stdc++.h> using namespace std; struct UFS { int sz; vector<int> rank, p; void link(int x, int y) { if (x == y) return; if (rank[x] > ra
2023 年华中科技大学程序设计竞赛新生赛
摘要:2023 年华中科技大学程序设计竞赛新生赛 P9774 [HUSTFC 2023] 新取模运算 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) \(n! \% p\),易知\(1 \sim n \% p\)为\(1,2,3\dots p - 1,0,1,2\dots\),所以我们可