結果

問題 No.314 ケンケンパ
ユーザー maine_honzukimaine_honzuki
提出日時 2021-05-16 19:01:26
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 1,000 ms
コード長 473 bytes
コンパイル時間 5,314 ms
コンパイル使用メモリ 254,900 KB
実行使用メモリ 7,104 KB
最終ジャッジ日時 2024-04-15 10:02:12
合計ジャッジ時間 5,524 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
7,040 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 4 ms
6,940 KB
testcase_19 AC 7 ms
7,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//https://ncode.syosetu.com/n4830bu/314/
#include <bits/stdc++.h>
using namespace std;

#include "atcoder/all"
using namespace atcoder;
using Mint = modint1000000007;

int main() {
    int N;
    cin >> N;
    vector<Mint> maine(N + 3);
    maine[0] = 1;
    for (int i = 0; i < N + 2; i++) {
        for (int j = 2; j <= 3; j++) {
            if (i - j >= 0)
                maine[i] += maine[i - j];
        }
    }
    cout << (maine[N + 1] + maine[N]).val() << endl;
}
0