結果

問題 No.314 ケンケンパ
ユーザー syunsukesyunsuke
提出日時 2019-04-23 00:02:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 54,680 KB
実行使用メモリ 15,232 KB
最終ジャッジ日時 2024-04-20 09:58:26
合計ジャッジ時間 1,436 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
15,104 KB
testcase_01 AC 9 ms
15,232 KB
testcase_02 AC 10 ms
15,232 KB
testcase_03 AC 10 ms
15,104 KB
testcase_04 AC 10 ms
15,104 KB
testcase_05 AC 10 ms
15,232 KB
testcase_06 AC 9 ms
15,232 KB
testcase_07 AC 10 ms
15,232 KB
testcase_08 AC 10 ms
15,232 KB
testcase_09 AC 10 ms
15,104 KB
testcase_10 AC 10 ms
15,232 KB
testcase_11 AC 9 ms
15,232 KB
testcase_12 AC 10 ms
15,232 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 10 ms
15,232 KB
testcase_16 AC 10 ms
15,232 KB
testcase_17 AC 10 ms
15,232 KB
testcase_18 AC 12 ms
15,104 KB
testcase_19 AC 15 ms
15,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int dp[1000005][3];
    int N;
    cin>>N;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=2;j++){
            dp[i][j]=0;
        }
    }
    dp[1][0]=1;
    for(int i=2;i<=N;i++){
        dp[i][0]=dp[i-1][2];
        dp[i][1]=dp[i-1][0];
        dp[i][2]=(dp[i-1][0]+dp[i-1][1])%(1000000007);
    }
    cout<<(dp[N][0]+dp[N][1]+dp[N][2])%(1000000007)<<endl;
}
0