3762347022
s 220pts
AFOed.
BEST 定理:
表示度数。
https://www.luogu.com.cn/paste/3sgvdsg6
IO(mmap):https://www.luogu.com.cn/discuss/970656
缺省:
#include "bits/stdc++.h"
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define OPEN freopen (".in", "r", stdin); freopen (".out", "w", stdout);
#define DATA freopen (".in", "w", stdout);
#define pc __builtin_popcount
#define db double
#define pii pair<int, int>
#define fi first
#define se second
#define F(i,x,y) for (int i = (x); i <= (y); ++i)
#define D(i,x,y) for (int i = (x); i >= (y); --i)
using namespace std;
constexpr ll inf = 1ll * 1e18;
// constexpr ll mod = 998244353ll;
constexpr ll mod = 1ll * 1e9 + 7ll;
namespace FastIO {
inline void Rd(int& x) {
int f = 1; x = 0; char c = getchar();
while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c - 48), c = getchar();
x *= f;
}
inline void Wt(int x) {
if (x < 0) {Wt (-x); return ;}
if (x < 10) {putchar(x + 48); return;}
Wt(x / 10);
putchar((x % 10) + 48);
}
}
constexpr int N = 2.5e5 + 5;
namespace Maths {
ll fac[N], ifac[N];
ll qpow(ll x, ll y) {
if (y == 0ll) return 1ll;
ll w = qpow(x, y / 2ll);
if (y % 2ll) return (w * w % mod) * x % mod;
else return w * w % mod;
}
inline ll div(ll x) {return qpow(x, mod - 2ll);}
void init() {
fac[0] = 1ll; F(i, 1, N - 1) fac[i] = fac[i - 1] * i % mod;
ifac[N - 1] = div (fac[N - 1]);
D (i, N - 2, 0) ifac[i] = ifac[i + 1] * (i + 1) % mod;
}
inline ll C(ll x, ll y) {
if (x < 0 || y < 0 || y > x) return 0LL;
return (fac[x] * ifac[y] % mod) * ifac[x - y] % mod;
}
}
