提交时间:2024-10-04 17:17:13

运行 ID: 33229

#include<bits/stdc++.h> using namespace std; const int N = 510,M = 2e5+10,md = 998244353; #define int long long int inv[M],pre[M]; int n; int m; int quickpow(int x,int y){ int tot=1; while(y){ if(y&1) tot=tot%md*x%md; x=x%md*x%md; y=y>>1; } return tot; } int C(int x,int y){ if(x<y) return 0; else return (pre[x]%md*inv[y]%md*inv[x-y]%md+md)%md; } signed main(){ ios::sync_with_stdio(false); cin>>n>>m; pre[0]=1; for(int i=1;i<=M-10;i++){ pre[i]=pre[i-1]*i%md; } for(int i=M-10;i>=0;i--){ inv[i]=quickpow(pre[i],md-2); } int ANS=0; for(int i=0;i<=m;i++){ for(int j=0;j<=n;j++){ int z=(2*m-2*i)%md*(2*m-2*i)%md; int p=C(n+i-1,i)*C(n,j)%md; int q=C(m-i-1,j-1)*C(n-j+m-i-1,m-i)%md; ANS=(ANS%md+z%md*p%md*q%md)%md; } } cout<<ANS%md<<endl; return 0; }