摘要:
Codeforces Round 911 (Div. 2) D D. Small GCD 题意 定义\(f(a,b,c)\)为\(a,b,c\)中较小两个数的\(gcd\),给定数组\(a_{1...n}\),求 \[\begin{aligned} \sum\limits_{i=1}^{n}\sum 阅读全文
摘要:
#include <bits/stdc++.h> using namespace std; template <typename T> class SparseTable { using VT = vector<T>; using VVT = vector<VT>; using func_type 阅读全文
摘要:
AtCoder Beginner Contest 328 A - Not Too Hard (atcoder.jp) #include <bits/stdc++.h> #define debug(a) cout<<#a<<"="<<a<<'\n'; using namespace std; usin 阅读全文
摘要:
//快速幂 //底数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 阅读全文