結果

問題 No.1186 長方形の敷き詰め
ユーザー tonyu0tonyu0
提出日時 2020-08-22 15:57:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 587 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 49,900 KB
最終ジャッジ日時 2024-04-23 10:12:24
合計ジャッジ時間 6,854 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,624 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 351 ms
49,720 KB
testcase_03 AC 26 ms
10,752 KB
testcase_04 AC 26 ms
10,752 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 25 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 25 ms
10,752 KB
testcase_09 AC 25 ms
10,624 KB
testcase_10 AC 25 ms
10,752 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 29 ms
11,008 KB
testcase_13 AC 27 ms
10,880 KB
testcase_14 AC 28 ms
11,008 KB
testcase_15 AC 26 ms
10,624 KB
testcase_16 AC 26 ms
10,624 KB
testcase_17 AC 130 ms
23,040 KB
testcase_18 AC 242 ms
36,172 KB
testcase_19 AC 275 ms
40,996 KB
testcase_20 AC 309 ms
44,528 KB
testcase_21 AC 220 ms
34,516 KB
testcase_22 TLE -
testcase_23 AC 223 ms
32,244 KB
testcase_24 AC 319 ms
44,768 KB
testcase_25 AC 201 ms
31,880 KB
testcase_26 AC 228 ms
34,748 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