题目链接:https://ac.nowcoder.com/acm/contest/5666/J
解题思路:
找出的转换公式即可
方法一:直接化简运算
利用的是分部积分法
方法二:找规律
n=1时,
n=2时,
n=2时,
所以可以推出 原式=
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
const int mod = 998244353;
const int maxn = 2e6 + 5;
ll fastpow(ll base, ll n, ll mod) {
ll ans = 1;
while (n) {
if (n & 1) ans *= base % mod, ans %= mod;
base *= base, base %= mod;
n >>= 1;
}
return ans % mod;
}
ll f[maxn];
int n;
int main() {
f[1] = 1;
for (int i = 2; i < maxn; i++) f[i] = f[i - 1] * i % mod;
while (~scanf("%d", &n)) {
ll x = f[n] * f[n] % mod;
ll y = f[2 * n + 1];
printf("%lld\n", x * fastpow(y, mod - 2, mod) % mod);
}
return 0;
}