結果

問題 No.2023 Tiling is Fun
ユーザー pitPpitP
提出日時 2022-07-29 22:24:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 117,948 KB
最終ジャッジ日時 2023-09-26 21:41:03
合計ジャッジ時間 4,006 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
117,376 KB
testcase_01 AC 117 ms
117,664 KB
testcase_02 AC 119 ms
117,520 KB
testcase_03 AC 115 ms
117,648 KB
testcase_04 AC 118 ms
117,688 KB
testcase_05 AC 114 ms
117,948 KB
testcase_06 AC 115 ms
117,720 KB
testcase_07 AC 120 ms
117,672 KB
testcase_08 AC 120 ms
117,776 KB
testcase_09 AC 118 ms
117,692 KB
testcase_10 AC 120 ms
117,800 KB
testcase_11 AC 119 ms
117,656 KB
testcase_12 AC 118 ms
117,372 KB
testcase_13 AC 117 ms
117,688 KB
testcase_14 AC 119 ms
117,704 KB
testcase_15 AC 120 ms
117,676 KB
testcase_16 AC 117 ms
117,752 KB
testcase_17 AC 118 ms
117,720 KB
testcase_18 AC 117 ms
117,680 KB
testcase_19 AC 119 ms
117,596 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

N = 202020
mod = 998244353 #出力の制限
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(cmb(a+b-2,a-1,mod))
0