結果

問題 No.1186 長方形の敷き詰め
ユーザー KKT89
提出日時 2020-10-14 18:48:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 194,728 KB
最終ジャッジ日時 2025-01-15 07:16:21
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

constexpr ll mod=998244353;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    if(n==1 or n>m)printf("1\n");
    else{
        vector<ll> dp(m+1);
        dp[0]=1;
        for(int i=0;i<m;i++){
            (dp[i+1]+=dp[i])%=mod;
            if(i+n<=m)(dp[i+n]+=dp[i])%=mod;
        }
        cout << dp[m] << endl;
    }
}
0