文章目录
- 题目大意
- 输入描述:
- 输出描述:
- 输入样例
- 输出样例
题目大意
Given n, find the value of ∫
It can be proved that the value is a rational number .
Print the result as (
输入描述:
The input consists of several test cases and is terminated by end-of-file.
Each test case contains an integer n.
- 1
- The number of test cases does not exceed 10
输出描述:
For each test case, print an integer which denotes the result.
输入样例
1
2
3输出样例
166374059
432572553
591816295For n = 1, =
求一下逆元
X=166374059,a=1,b=6;
a/b mod 998244353==X
a mod 998244353 == b*X mod 998244353
oeis
#include <cstdio>
#include <algorithm>
#define rep(i,a,b) for(auto i=a;i<=b;++i)
using namespace std;
typedef long long ll;
const int mod=998244353,maxn=1e6+7;
ll a[maxn<<1],b[maxn<<1],inv[maxn<<1];
int main()
{
int n;
a[0]=b[0]=b[1]=inv[1]=inv[0]=1;
rep(i,1,maxn<<1){
a[i]=a[i-1]*i%mod;
if(i>1) inv[i]=(mod-mod/i)*inv[mod%i]%mod,b[i]=b[i-1]*inv[i]%mod;
}
while(~scanf("%d",&n))
printf("%lld\n",((a[n]%mod*a[n]%mod*b[(n<<1)+1]%mod)+mod)%mod);
return 0;
}
















