結果

問題 No.1186 長方形の敷き詰め
ユーザー tonyu0tonyu0
提出日時 2020-08-22 15:57:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 518 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 1,213 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 83,748 KB
最終ジャッジ日時 2023-08-05 12:59:41
合計ジャッジ時間 3,819 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,252 KB
testcase_01 AC 68 ms
71,240 KB
testcase_02 AC 78 ms
83,568 KB
testcase_03 AC 71 ms
71,324 KB
testcase_04 AC 70 ms
71,320 KB
testcase_05 AC 66 ms
71,396 KB
testcase_06 AC 68 ms
71,060 KB
testcase_07 AC 71 ms
71,288 KB
testcase_08 AC 69 ms
71,252 KB
testcase_09 AC 69 ms
71,348 KB
testcase_10 AC 67 ms
71,288 KB
testcase_11 AC 70 ms
75,912 KB
testcase_12 AC 70 ms
75,832 KB
testcase_13 AC 70 ms
75,772 KB
testcase_14 AC 73 ms
75,628 KB
testcase_15 AC 72 ms
75,628 KB
testcase_16 AC 72 ms
75,672 KB
testcase_17 AC 72 ms
78,196 KB
testcase_18 AC 78 ms
80,868 KB
testcase_19 AC 79 ms
81,752 KB
testcase_20 AC 81 ms
82,528 KB
testcase_21 AC 77 ms
80,416 KB
testcase_22 AC 518 ms
83,748 KB
testcase_23 AC 79 ms
79,996 KB
testcase_24 AC 80 ms
82,548 KB
testcase_25 AC 75 ms
79,776 KB
testcase_26 AC 76 ms
80,456 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