結果

問題 No.2791 Beginner Contest
ユーザー navel_tosnavel_tos
提出日時 2024-06-21 22:59:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 61,532 KB
最終ジャッジ日時 2024-06-21 22:59:44
合計ジャッジ時間 2,157 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,284 KB
testcase_01 AC 37 ms
52,816 KB
testcase_02 AC 44 ms
60,160 KB
testcase_03 AC 36 ms
52,604 KB
testcase_04 AC 36 ms
53,072 KB
testcase_05 AC 33 ms
51,876 KB
testcase_06 AC 39 ms
61,300 KB
testcase_07 AC 37 ms
59,392 KB
testcase_08 AC 37 ms
59,112 KB
testcase_09 AC 42 ms
60,860 KB
testcase_10 AC 40 ms
61,156 KB
testcase_11 AC 39 ms
61,460 KB
testcase_12 AC 41 ms
61,292 KB
testcase_13 AC 41 ms
61,336 KB
testcase_14 AC 44 ms
59,860 KB
testcase_15 AC 40 ms
61,532 KB
testcase_16 AC 34 ms
52,464 KB
testcase_17 AC 32 ms
53,492 KB
testcase_18 AC 41 ms
61,256 KB
testcase_19 AC 41 ms
60,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
MOD = 998244353
DP = [1] + [0] * N
C = [0] * (N + 2)
for i in range(N + 1):
	Lt = i - K
	if Lt >= 0:
		DP[i] = C[Lt + 1] - C[0]
		DP[i] %= MOD
	C[i + 1] = C[i] + DP[i]
	C[i + 1] %= MOD
print(sum(DP) % MOD)
0