https://ac.nowcoder.com/acm/contest/5205/B
他给你的算法可以转换成重0,0除法到x,y有多少种走法在t个时间里,每个时间选择上,右或者不动
C(t,x+y)*C(x+y,x)
#include<iostream> #include<algorithm> #include<queue> #define ll long long using namespace std; const ll mod=998244353; const int maxn=2e5+117; ll fac[maxn]; ll inv[maxn]; ll C(int n,int m) { if(m>n) return 0; return fac[n]*inv[m]%mod*inv[n-m]%mod; } ll quick_mod(ll a,ll m) { ll tmp=a%mod; ll ans=1; while(m) { if(m&1) ans=ans*tmp%mod; tmp=tmp*tmp%mod; m>>=1; } return ans%mod; } void init() { fac[0]=1; for(int i=1; i<maxn; i++) fac[i]=(fac[i-1]*i)%mod; inv[maxn-1]=quick_mod(fac[maxn-1],mod-2); for(int i=maxn-2; i>=0; i--) inv[i]=(inv[i+1]*(i+1))%mod; } int main(){ init(); int t; cin>>t; while(t--){ ll x,y,t; cin>>x>>y>>t; ll ans = C(t,x+y) * C(x+y,x)%mod; cout<<ans<<endl; } return 0; }