結果

問題 No.1186 長方形の敷き詰め
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-08-02 17:32:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 92,112 KB
最終ジャッジ日時 2023-09-26 06:17:18
合計ジャッジ時間 12,801 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,292 KB
testcase_01 AC 74 ms
71,376 KB
testcase_02 AC 963 ms
91,716 KB
testcase_03 AC 73 ms
71,048 KB
testcase_04 AC 73 ms
71,300 KB
testcase_05 AC 71 ms
71,488 KB
testcase_06 AC 72 ms
71,296 KB
testcase_07 AC 74 ms
71,212 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 81 ms
76,064 KB
testcase_12 AC 88 ms
75,988 KB
testcase_13 AC 80 ms
75,972 KB
testcase_14 AC 82 ms
76,064 KB
testcase_15 AC 81 ms
76,168 KB
testcase_16 AC 79 ms
75,948 KB
testcase_17 AC 362 ms
81,252 KB
testcase_18 AC 654 ms
86,216 KB
testcase_19 AC 764 ms
88,052 KB
testcase_20 AC 849 ms
89,612 KB
testcase_21 AC 611 ms
85,656 KB
testcase_22 AC 973 ms
92,112 KB
testcase_23 AC 564 ms
84,772 KB
testcase_24 AC 843 ms
89,576 KB
testcase_25 AC 559 ms
84,480 KB
testcase_26 AC 613 ms
85,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
def comb(n, r):
    if n < r:return 0
    if n < 0 or r < 0:return 0
    return fa[n] * fi[r] % mod * fi[n - r] % mod
n, m = map(int, input().split())
fa = [1] * (m + 1)
fi = [1] * (m + 1)
for i in range(1, m + 1):
    fa[i] = fa[i - 1] * i % mod
    fi[i] = pow(fa[i], mod - 2, mod)
ans = 0
for i in range(m // n + 1):
    ans += comb(m - i * (n - 1), i)
    ans %= mod
print(ans % mod)
0