結果
問題 | No.2791 Beginner Contest |
ユーザー | june19312 |
提出日時 | 2024-06-21 22:20:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 310 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 82,836 KB |
実行使用メモリ | 63,196 KB |
最終ジャッジ日時 | 2024-06-21 22:20:19 |
合計ジャッジ時間 | 1,840 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,040 KB |
testcase_01 | AC | 37 ms
52,304 KB |
testcase_02 | AC | 46 ms
61,820 KB |
testcase_03 | AC | 37 ms
52,548 KB |
testcase_04 | AC | 38 ms
52,580 KB |
testcase_05 | AC | 38 ms
52,952 KB |
testcase_06 | AC | 46 ms
62,528 KB |
testcase_07 | AC | 44 ms
59,828 KB |
testcase_08 | AC | 45 ms
60,348 KB |
testcase_09 | AC | 47 ms
62,676 KB |
testcase_10 | AC | 48 ms
61,488 KB |
testcase_11 | AC | 44 ms
59,332 KB |
testcase_12 | AC | 48 ms
63,196 KB |
testcase_13 | AC | 43 ms
60,028 KB |
testcase_14 | AC | 43 ms
60,024 KB |
testcase_15 | AC | 44 ms
59,780 KB |
testcase_16 | AC | 38 ms
52,332 KB |
testcase_17 | AC | 39 ms
52,892 KB |
testcase_18 | AC | 44 ms
59,148 KB |
testcase_19 | AC | 44 ms
59,520 KB |
ソースコード
mod = 998244353 N,K = map(int,input().split()) dp = [0]*(N+3) dp[0] = 1 dp[1] = -1 for i in range(N+2): if i != 0: dp[i] += dp[i-1] dp[i] %= mod if i+K <= N: dp[i+K] += dp[i] dp[i+K] %= mod dp[N+1] -= dp[i] dp[N+1] %= mod print(sum(dp)%mod) #print(dp)