結果
| 問題 |
No.1186 長方形の敷き詰め
|
| コンテスト | |
| ユーザー |
CELICA
|
| 提出日時 | 2020-08-28 06:43:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 681 bytes |
| コンパイル時間 | 1,623 ms |
| コンパイル使用メモリ | 167,444 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-09 01:01:44 |
| 合計ジャッジ時間 | 2,522 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
constexpr ll mod = 998244353;
ll n, m, res;
cin >> n >> m;
if (n == 1)
res = 1;
else if (n == m)
res = 2;
else if (n > m)
res = 1;
else
{
vector<ll> f(m + 1);
f[0] = 1;
for (ll i = 1; i <= m; ++i)
{
f[i] = f[i - 1];
if (i >= n)
f[i] += f[i - n];
f[i] %= mod;
}
res = f[m - 1] + f[m - n];
res %= mod;
}
cout << res << "\n";
return 0;
}
CELICA