摘要: //快速幂 //底数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; 阅读全文
posted @ 2023-10-31 19:28 Ke_scholar 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 欧拉定理求质因数: //欧拉定理求质因数 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 阅读全文
posted @ 2023-10-31 19:26 Ke_scholar 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #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 阅读全文
posted @ 2023-10-31 19:26 Ke_scholar 阅读(31) 评论(0) 推荐(0) 编辑