結果

問題 No.1989 Pairing Multiset
コンテスト
ユーザー vjudge1
提出日時 2025-10-16 15:44:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 1,379 ms
コンパイル使用メモリ 161,580 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-16 15:44:46
合計ジャッジ時間 6,221 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,m;
const int mod=998244353;
int qp(int a,int b){
	int ans=1;
	while(b){
		if(b&1){
			ans=ans*a;
			ans%=mod;
		}
		a=a*a;a%=mod;
		b>>=1;
	}
	return ans;
}
int C(int n,int m){
	int ans=1;
	for(int x=m+1;x<=n;x++){
		ans=ans*x%mod;
	}
	for(int x=1;x<=n-m;x++){
		ans=ans*qp(x,mod-2)%mod;
	}
	return ans%mod;
}
signed main(){
	cin>>n>>m;
	cout<<n*C(n*2+m,m-1)%mod;
}
/*

*/
0