結果

問題 No.1186 長方形の敷き詰め
ユーザー ktr216ktr216
提出日時 2020-08-22 13:37:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 1,442 ms
コンパイル使用メモリ 164,508 KB
実行使用メモリ 42,356 KB
最終ジャッジ日時 2024-04-23 08:03:00
合計ジャッジ時間 2,414 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,008 KB
testcase_01 AC 4 ms
11,120 KB
testcase_02 AC 5 ms
11,008 KB
testcase_03 AC 3 ms
11,012 KB
testcase_04 AC 5 ms
11,156 KB
testcase_05 AC 4 ms
11,184 KB
testcase_06 AC 4 ms
11,004 KB
testcase_07 AC 4 ms
11,012 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 4 ms
11,008 KB
testcase_12 AC 3 ms
11,144 KB
testcase_13 AC 4 ms
11,008 KB
testcase_14 AC 3 ms
11,136 KB
testcase_15 AC 4 ms
11,008 KB
testcase_16 AC 4 ms
11,184 KB
testcase_17 AC 4 ms
11,008 KB
testcase_18 AC 4 ms
11,008 KB
testcase_19 AC 3 ms
11,008 KB
testcase_20 AC 4 ms
11,008 KB
testcase_21 AC 5 ms
11,008 KB
testcase_22 AC 43 ms
42,356 KB
testcase_23 AC 25 ms
28,416 KB
testcase_24 AC 17 ms
21,876 KB
testcase_25 AC 6 ms
13,440 KB
testcase_26 AC 3 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

ll N, M, MOD = 998244353;
vector<ll> f(1000001, -1);

ll solve(int x) {
    if (f[x] != -1) return f[x];
    if (x < N) {
        f[x] = 1;
        return 1;
    }
    f[x] = (solve(x - 1) + solve(x - N)) % MOD;
    return f[x];
}

int main() {
    cin >> N >> M;
    cout << solve(M) << "\n";
}
0