j题详细题解
B-Suffix Array
https://ac.nowcoder.com/acm/contest/5666/A
- 求(贝塔函数运用)
- 证明:
法二: [贝塔函数---链接](https://baike.baidu.com/item/%E8%B4%9D%E5%A1%94%E5%87%BD%E6%95%B0/4643050?fr=aladdin)
考点:费马定理 $$
#include<iostream> #include<cstdio> using namespace std; typedef long long ll; const ll mod = 998244353; const ll maxn = 2E6+5; ll f[maxn]; void init()//阶乘处理 { f[1] = 1; for (int i = 2;i <= maxn;i++) { f[i] = f[i - 1] * i % mod; } } ll Mod(ll a, ll p)//快速幂取模 { ll ans = 1; while (p) { if (p & 1) ans = (ans * a) % mod; a = a * a % mod; p >>= 1; } return ans; } int main() { int n; init(); while (scanf("%d", &n) != EOF) { //费马定理 cout << f[n] * f[n] % mod * Mod(f[2 * n + 1], mod - 2)%mod<<endl; } return 0; }