跳到正文

Yu_Chengxuan

782210

河把我不想忘记的故事 也带走

这是 2026年10月22日 存档的第 1 版,不是当前版本。查看当前版本

资料、奖项与版本

资料

编号
782210
抓取

版本

  1. v2当前
  2. v1

缺省源

C++
#include <bits/stdc++.h>
#define L(i, j, k) for (int i = (j); i <= (k); i++)
#define R(i, j, k) for (int i = (j); i >= (k); i--)
using namespace std;
using ll = long long;
constexpr int N = 1e5 + 10; 

文件读写

C++
#define file(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout)

快读

C++
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF: *p1++)
char buf[1 << 21], *p1 = buf, *p2 = buf;
inline int rd() {
  int x = 0, f = 1; char ch = getchar();
  while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
  while (ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
  return x * f;
}

快写

C++
void write(int x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}

快速幂

C++
inline int qpow(int x, int y = mod - 2) {
  int res = 1;
  for (; y; x = (ll) x * x % mod, y >>= 1) if (y & 1) res = (ll) res * x % mod;
  return res;
}

组合数

C++
inline void init(int n) {
  fac[0] = 1;
  L(i, 1, n) fac[i] = (ll) fac[i - 1] * i % mod;
  ifac[n] = qpow(fac[n]);
  R(i, n - 1, 0) ifac[i] = (ll) ifac[i + 1] * (i + 1) % mod;
}
inline int C(int x, int y) {
  if (x < y || x < 0 || y < 0) return 0;
  return (ll) fac[x] * ifac[x - y] % mod * ifac[y] % mod;
}