結果

問題 No.2023 Tiling is Fun
ユーザー EguyEguy
提出日時 2022-07-29 22:03:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 838 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 78,928 KB
最終ジャッジ日時 2023-09-26 20:59:06
合計ジャッジ時間 3,106 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
78,824 KB
testcase_01 AC 86 ms
78,696 KB
testcase_02 AC 89 ms
78,704 KB
testcase_03 AC 88 ms
78,572 KB
testcase_04 AC 89 ms
78,820 KB
testcase_05 AC 89 ms
78,796 KB
testcase_06 AC 88 ms
78,884 KB
testcase_07 AC 86 ms
78,672 KB
testcase_08 AC 86 ms
78,864 KB
testcase_09 AC 87 ms
78,668 KB
testcase_10 AC 88 ms
78,864 KB
testcase_11 AC 89 ms
78,812 KB
testcase_12 AC 89 ms
78,904 KB
testcase_13 AC 87 ms
78,744 KB
testcase_14 AC 86 ms
78,772 KB
testcase_15 AC 85 ms
78,856 KB
testcase_16 AC 88 ms
78,836 KB
testcase_17 AC 87 ms
78,928 KB
testcase_18 AC 86 ms
78,852 KB
testcase_19 AC 88 ms
78,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
sys.setrecursionlimit(1000000)
INF = 1 << 100
#mod = 1000000007
mod = 998244353
input = lambda: sys.stdin.readline().rstrip()
li = lambda: list(map(int, input().split()))

def enumfif(n, mod):
    f = [0] * (n+1)
    invf = [0] * (n+1)
    f[0] = 1
    for i in range(1, n+1):
        f[i] = f[i-1] * i % mod
 
    a = f[n]
    b = mod
    p, q = 1, 0
    while b > 0:
        c = a//b
        d = a; a = b; b = d % b
        d = p; p = q; q = d-c*q
    invf[n] = p + mod if p < 0 else p
    for i in range(n-1,-1,-1):
        invf[i] = invf[i+1] * (i+1) % mod
    return f, invf
fif = enumfif(2*(10**5)+5, mod) 
 
def C(n, r):
    if n < 0 or r < 0 or r > n:
        return 0
    return fif[0][n] * fif[1][r] * fif[1][n-r] % mod

def P(n, r):
    return fif[0][n] * fif[1][n-r] % mod


A, B = li()
print(C(A+B - 2, A-1))
0