結果

問題 No.2791 Beginner Contest
ユーザー karinohito
提出日時 2024-09-19 21:58:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 1,861 ms
コンパイル使用メモリ 195,436 KB
最終ジャッジ日時 2025-02-24 09:34:09
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ll N,K,mod=998244353;
    cin>>N>>K;
    K=min(K,N+1);
    vector<ll> SDP(N+1,0);
    for(int i=0;i<K;i++)SDP[i]=1;
    for(int i=K;i<=N;i++){
        SDP[i]=(SDP[i-K]+SDP[i-1])%mod;
    } 
    cout<<SDP[N]<<endl;
}
0