結果
問題 |
No.2791 Beginner Contest
|
ユーザー |
|
提出日時 | 2024-06-22 05:02:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 447 bytes |
コンパイル時間 | 1,393 ms |
コンパイル使用メモリ | 167,040 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 05:02:49 |
合計ジャッジ時間 | 2,235 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define REP(i,n) for(ll i=0;i<ll(n);i++) const ll MOD=998244353; ll dp[100010]; int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i; ll N,K; cin >> N >> K; dp[0]=1; for(i=1;i<=N;i++){ dp[i]+=dp[i-1]; dp[i]%=MOD; if(i-K>=0) dp[i]+=dp[i-K]; dp[i]%=MOD; } cout << dp[N] << endl; return 0; }