結果

問題 No.2023 Tiling is Fun
ユーザー rlangevinrlangevin
提出日時 2023-01-28 16:19:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 84,072 KB
最終ジャッジ日時 2023-09-11 05:08:26
合計ジャッジ時間 4,229 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
83,796 KB
testcase_01 AC 93 ms
83,744 KB
testcase_02 AC 94 ms
83,800 KB
testcase_03 AC 97 ms
83,960 KB
testcase_04 AC 92 ms
83,872 KB
testcase_05 AC 92 ms
83,676 KB
testcase_06 AC 93 ms
83,880 KB
testcase_07 AC 92 ms
83,840 KB
testcase_08 AC 93 ms
83,772 KB
testcase_09 AC 94 ms
83,800 KB
testcase_10 AC 95 ms
83,768 KB
testcase_11 AC 94 ms
83,860 KB
testcase_12 AC 94 ms
84,072 KB
testcase_13 AC 93 ms
83,684 KB
testcase_14 AC 95 ms
83,760 KB
testcase_15 AC 91 ms
84,072 KB
testcase_16 AC 92 ms
83,860 KB
testcase_17 AC 91 ms
83,960 KB
testcase_18 AC 90 ms
83,820 KB
testcase_19 AC 91 ms
83,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, input().split())
mod = 998244353

n = 505050

fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n):
    fact[i + 1] = ((i+1) * fact[i]) % mod
invfact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % mod

def comb(n, r):
    if n < 0 or r < 0 or n - r < 0:
        return 0
    return fact[n] * invfact[r] * invfact[n - r] % mod

print(comb(a + b - 2, a - 1))
0