結果

問題 No.2023 Tiling is Fun
ユーザー 👑 H20H20
提出日時 2022-07-29 23:05:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 137,440 KB
最終ジャッジ日時 2023-09-26 22:41:36
合計ジャッジ時間 4,389 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
137,304 KB
testcase_01 AC 136 ms
137,400 KB
testcase_02 AC 137 ms
137,308 KB
testcase_03 AC 138 ms
137,028 KB
testcase_04 AC 138 ms
136,908 KB
testcase_05 AC 136 ms
137,040 KB
testcase_06 AC 138 ms
136,900 KB
testcase_07 AC 140 ms
137,028 KB
testcase_08 AC 137 ms
137,124 KB
testcase_09 AC 140 ms
137,332 KB
testcase_10 AC 142 ms
136,856 KB
testcase_11 AC 138 ms
137,084 KB
testcase_12 AC 134 ms
137,328 KB
testcase_13 AC 133 ms
136,904 KB
testcase_14 AC 135 ms
137,156 KB
testcase_15 AC 133 ms
137,300 KB
testcase_16 AC 135 ms
137,396 KB
testcase_17 AC 135 ms
137,060 KB
testcase_18 AC 132 ms
137,024 KB
testcase_19 AC 133 ms
137,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#コンビネーション
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353
N = 3*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

A,B = map(int, input().split())
print(g1[A+B-2]*g2[A-1]*g2[B-1]%mod)
0