输入n(n<=1e6)要你求 ∫ 0 1 \int_0^1 ∫01 ( x − x 2 ) n (x-x^2)^n (x−x2)n
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define fi first
#define se second
#define debug printf("I am here\n");
using namespace std;
typedef long long ll;
const int maxn=2e6+5,mod=998244353;
int t,n;
ll fac[maxn],inv[maxn];
ll qpow(ll a,ll b){
ll ans=1,base=a;
while(b){
if(b&1){
ans=ans*base%mod;
}
base=base*base%mod;
b=b>>1;
}
return ans;
}
void init(){
fac[0]=1;
for(int i=1;i<=2e6;i++){
fac[i]=fac[i-1]*i%mod;
}
inv[2000000]=qpow(fac[2000000],mod-2);
for(int i=2e6-1;i>=1;i--){
inv[i]=inv[i+1]*(i+1)%mod;
}
}
signed main(){
init();
while(scanf("%d",&n)!=-1){
printf("%lld\n",fac[n]*fac[n]%mod*inv[2*n+1]%mod);
}
return 0;
}
参考链接:https://blog.csdn.net/weixin_44235989/article/details/107305849?%3E