跳到正文

Phartial

376161

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

这是 2026年11月2日 存档的第 4 版,不是当前版本。查看当前版本

资料、奖项与版本

资料

编号
376161
抓取

版本

  1. v5当前
  2. v4
  3. v3
  4. v2
更早的 1 个版本
  1. v1

todo:

  • day24
  • misc7
  • misc8
  • tanxin2
  • day21
  • day22
  • graph1
  • convex1
  • misc6
  • adhoc2
  • 联合省选 2026

深度好文

一些可能需要的东西:

这里应该有张 vuqa

分拆数:https://oeis.org/A000041/b000041.txt, pn≈143neπ23n≈17n13np_n\approx \frac{1}{4\sqrt{3}n}e^{\pi\sqrt{\frac{2}{3}n}}\approx\frac{1}{7n}13^{\sqrt{n}}。

Bell 数:https://oeis.org/A000110/a000110.txt

质数:https://www.cnblogs.com/ljxtt/p/13514346.html

由 mm 个大小分别为 a1,…,ama_1,\dots,a_m 的连通块所连接而成的有标号无根树的方案数为 (∑a)m−2∏a(\sum a)^{m-2}\prod a。

将 nn 个有标号点连成 rr 棵无根树的方案数为 rnn−r−1rn^{n-r-1}。

[zn]G=[zn]F+1n∑i=1n−1i[zi]F[zn−i]G[z^{n}]G=[z^n]F+\frac{1}{n}\sum_{i=1}^{n-1} i[z^{i}]F[z^{n-i}]G\\

(G=exp⁡FG=\exp F)

∑i=0x(y+1i)=2∑i=0x(yi)−(yx)\sum_{i=0}^x{y+1\choose i}=2\sum_{i=0}^x{y\choose i}-{y\choose x}
C++
int inv(int x, int m) { return x == 1 ? 1 : m - 1LL * inv(m % x, x) * m / x; }
C++
pair<int, int> approx(int p, int q, int A) { // approx(998244353, 499122177, 100)={1,2}
  int x = q, y = p, a = 1, b = 0;
  while (x > A) {
    swap(x, y); swap(a, b);
    a -= x / y * b;
    x %= y;
  }
  return make_pair(x, a);
}
C++
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
C++
u64 add(u64 a, u64 b, u64 MOD) { return a + b >= MOD ? a + b - MOD : a + b; }
u64 sub(u64 a, u64 b, u64 MOD) { return a >= b ? a - b : a - b + MOD; }
u64 mul(u64 a, u64 b, u64 MOD) {
  long long r = a * b - (u64)((long double)a * b / MOD) * MOD;
  if (r < 0) {
    r += MOD;
  }
  return r % MOD;
}

fast io: https://www.luogu.com.cn/paste/2jw1qdjx

fss: https://www.luogu.com.cn/paste/p3uw6set

fps: https://www.luogu.com.cn/paste/45tigrd5

bitset: https://www.luogu.com.cn/paste/vxwnuxzg

modint (montgomery): https://www.luogu.com.cn/paste/uhgewqoc

modint (barrett): https://www.luogu.com.cn/paste/cy0ovvsw

线性序列并查集: https://www.luogu.com.cn/paste/dmu5zbdx

压位 Trie: https://www.luogu.com.cn/paste/rgfcumhh

编译期随机质数: https://www.luogu.com.cn/paste/tepfpw36

IO 交互:https://znpdco.github.io/blog/2024/07/27/interactive/