結果

問題 No.2023 Tiling is Fun
ユーザー tamatotamato
提出日時 2022-07-29 21:55:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 80,912 KB
最終ジャッジ日時 2023-09-26 20:44:59
合計ジャッジ時間 3,179 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
80,664 KB
testcase_01 AC 91 ms
80,372 KB
testcase_02 AC 86 ms
80,756 KB
testcase_03 AC 85 ms
80,496 KB
testcase_04 AC 86 ms
80,692 KB
testcase_05 AC 84 ms
80,672 KB
testcase_06 AC 85 ms
80,536 KB
testcase_07 AC 87 ms
80,444 KB
testcase_08 AC 89 ms
80,768 KB
testcase_09 AC 86 ms
80,452 KB
testcase_10 AC 87 ms
80,692 KB
testcase_11 AC 88 ms
80,540 KB
testcase_12 AC 86 ms
80,432 KB
testcase_13 AC 87 ms
80,536 KB
testcase_14 AC 86 ms
80,572 KB
testcase_15 AC 87 ms
80,416 KB
testcase_16 AC 88 ms
80,632 KB
testcase_17 AC 87 ms
80,468 KB
testcase_18 AC 87 ms
80,912 KB
testcase_19 AC 86 ms
80,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    # comb init
    # mod = 1000000007
    nmax = 2 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod
    
    a, b = map(int, input().split())
    print(comb(a + b - 2, a - 1))
    

if __name__ == '__main__':
    main()
0