Untitled

Text Views: 31 • Oct 27, 2026 • Never expires
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;
int p,q,tt,T,n[1145],m[1145],a[1145],b[1145],c[1145],d[1145],dp[1145][1919810]={{1}};
int res;
inline int maxx(int a,int b){
	return ((a>b)?a:b);
}
inline int qpow(int& a,int b){
	res=1;
	while(b){
		if(b&1)
			res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}
signed main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	freopen("Jinhsi.in","r",stdin);
	freopen("Jinhsi.out","w",stdout);
	cin>>T;
	tt=T;
	while(T--){
		cin>>n[T]>>m[T]>>a[T]>>b[T]>>c[T]>>d[T];
		n[0]=maxx(n[0],n[T]);
		m[0]=maxx(m[0],m[T]);
	}
	for(int i=0;i<=n[0];i++){
		for(int j=0;j<=m[0];j++){
			dp[i][j]=dp[i-1][j]+dp[i][j-1];
		}
	}
	while(tt--){
		q=dp[n[tt]][m[tt]];
		
		cout<<p*qpow(q,mod-2)%mod<<'\n';
	}
	return 0;
}
/*
299473306
998244353
1  1  1  1
1  2  3  4
1  3  6  10
1  4  10 15
*/
🛡️

Ad Blocker Detected

PasteBin.site is free to use thanks to our sponsors. Please consider disabling your ad blocker or whitelisting our site to support our servers.

Learn More