結果

問題 No.314 ケンケンパ
ユーザー RyuRyu
提出日時 2017-12-18 22:58:42
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 56,788 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-12-16 00:53:33
合計ジャッジ時間 1,472 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>

using namespace std;

const long long int MOD = 1e9 + 7;

int main()
{
    long int N = 0;
    long int dp[1000010];

    cin >> N;

    dp[0] = 1;
    dp[1] = 2;
    dp[2] = 2;

    for(int i = 3; i < N; i++)
    {
        dp[i] = dp[i - 2] + dp[i - 3];
    }

    cout << dp[N - 1] % MOD << endl;
    return 0;
}
0