結果

問題 No.1186 長方形の敷き詰め
ユーザー tonyu0tonyu0
提出日時 2020-08-22 15:57:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 469 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 82,848 KB
実行使用メモリ 68,828 KB
最終ジャッジ日時 2024-04-23 10:12:40
合計ジャッジ時間 2,471 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,616 KB
testcase_01 AC 37 ms
52,004 KB
testcase_02 AC 47 ms
65,612 KB
testcase_03 AC 33 ms
51,968 KB
testcase_04 AC 34 ms
52,224 KB
testcase_05 AC 34 ms
51,968 KB
testcase_06 AC 36 ms
51,968 KB
testcase_07 AC 34 ms
51,456 KB
testcase_08 AC 34 ms
51,584 KB
testcase_09 AC 32 ms
51,840 KB
testcase_10 AC 32 ms
51,712 KB
testcase_11 AC 35 ms
57,472 KB
testcase_12 AC 39 ms
57,856 KB
testcase_13 AC 37 ms
57,728 KB
testcase_14 AC 36 ms
57,472 KB
testcase_15 AC 36 ms
57,472 KB
testcase_16 AC 36 ms
57,856 KB
testcase_17 AC 41 ms
60,288 KB
testcase_18 AC 45 ms
62,720 KB
testcase_19 AC 45 ms
63,616 KB
testcase_20 AC 46 ms
64,640 KB
testcase_21 AC 43 ms
62,464 KB
testcase_22 AC 469 ms
68,828 KB
testcase_23 AC 43 ms
62,336 KB
testcase_24 AC 45 ms
64,384 KB
testcase_25 AC 41 ms
62,080 KB
testcase_26 AC 42 ms
62,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
mod = 998244353

# 1 * nで
# n * mを埋める

# nの使い方
# まずたて * m
# そのうちm - n, m - n - nを横にする。
# たてnなので横の列は横におくしかない
# 横の種類数はm // nこ

# n == 1 の時
if n == 1:
  print(1)
  exit()


fact = [1] * (m + 5)
for i in range(1, m + 5):
    fact[i] = fact[i - 1] * i % mod



def comb(n, k):
    return fact[n] * pow(fact[n - k] * fact[k] % mod, mod - 2, mod) % mod


ans = 0
for i in range(m // n + 1):
    tot = m - n * i + i
    ans = (ans + comb(tot, i)) % mod
print(ans)
0