結果
問題 |
No.1186 長方形の敷き詰め
|
ユーザー |
|
提出日時 | 2020-09-01 03:33:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 2,192 ms |
コンパイル使用メモリ | 193,520 KB |
最終ジャッジ日時 | 2025-01-14 02:49:41 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int64_t MOD = 998244353; void add(int64_t& a, int64_t b){ a = (a+b) % MOD; } void mul(int64_t& a, int64_t b){ a = a*b % MOD; } int main(){ int N, M; cin >> N >> M; vector<int64_t> dp(M+1); dp[0] = 1; for(int i=0; i<M; i++){ add(dp[i+1], dp[i]); if(N > 1 && i+N <= M) add(dp[i+N], dp[i]); } cout << dp[M] << endl; return 0; }