結果

問題 No.314 ケンケンパ
ユーザー agoyragoyr
提出日時 2018-10-24 17:12:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 104 ms / 1,000 ms
コード長 435 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 66,408 KB
実行使用メモリ 73,344 KB
最終ジャッジ日時 2024-04-29 21:25:34
合計ジャッジ時間 1,736 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
72,320 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 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 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 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 4 ms
5,376 KB
testcase_17 AC 12 ms
10,240 KB
testcase_18 AC 49 ms
36,972 KB
testcase_19 AC 103 ms
73,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<vector>
#include<cmath>
using namespace std;

#define int long long

const int INF=1e9+7;
int N;

signed main(){
    
    cin>>N;
    vector<vector<int> > dp(N+1,vector<int>(4,0));
    dp[1][1]=1;
    for(int i=1;i<N;i++){
        (dp[i+1][1]+=dp[i][0])%=INF;
        (dp[i+1][0]+=dp[i][1]+dp[i][2])%=INF;
        (dp[i+1][2]+=dp[i][1])%=INF;
    }
    cout<<((dp[N][0]+dp[N][1])%INF+dp[N][2])%INF<<endl;
}
0