結果

問題 No.314 ケンケンパ
ユーザー agoyragoyr
提出日時 2018-10-24 17:08:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 67,064 KB
実行使用メモリ 57,740 KB
最終ジャッジ日時 2024-04-29 21:25:30
合計ジャッジ時間 1,394 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
56,832 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 10 ms
8,576 KB
testcase_18 AC 37 ms
29,312 KB
testcase_19 AC 77 ms
57,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

int 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]+dp[N][2])%INF<<endl;
}
0