結果

問題 No.1186 長方形の敷き詰め
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-09-06 18:00:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 428 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 89,260 KB
最終ジャッジ日時 2024-05-06 21:19:47
合計ジャッジ時間 19,443 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,624 KB
testcase_01 AC 25 ms
10,752 KB
testcase_02 TLE -
testcase_03 AC 27 ms
10,624 KB
testcase_04 AC 28 ms
10,624 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 26 ms
10,624 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 42 ms
11,392 KB
testcase_13 AC 28 ms
10,624 KB
testcase_14 AC 39 ms
11,264 KB
testcase_15 AC 30 ms
10,752 KB
testcase_16 AC 27 ms
10,880 KB
testcase_17 AC 724 ms
35,328 KB
testcase_18 AC 1,522 ms
61,568 KB
testcase_19 AC 1,723 ms
71,168 KB
testcase_20 AC 1,960 ms
78,464 KB
testcase_21 AC 1,396 ms
57,984 KB
testcase_22 TLE -
testcase_23 AC 1,236 ms
54,144 KB
testcase_24 AC 1,969 ms
78,976 KB
testcase_25 AC 1,216 ms
53,120 KB
testcase_26 AC 1,404 ms
58,752 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())
if n == 1:
    exit(print(1))
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], -1, mod)
ans = 0
for i in range(m // n + 1):
    ans += comb(m - i * (n - 1), i)
    ans %= mod
print(ans % mod)
0