結果

問題 No.314 ケンケンパ
ユーザー nassy_motennassy_moten
提出日時 2018-11-17 22:28:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 61,932 KB
実行使用メモリ 26,704 KB
最終ジャッジ日時 2023-08-26 01:47:41
合計ジャッジ時間 1,608 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
26,508 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 9 ms
14,556 KB
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:10: warning: ‘a’ is used uninitialized in this function [-Wuninitialized]
         a+=dp[n][i]%bba;
         ~^~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long dp[1001000][3]={};
int main(){
    int bba=1000000007;
    int n;
    cin>>n;
    dp[1][1]=1;
    dp[1][0]=dp[1][2]=0;
    for(int i=1;i<=n+5;i++){
        dp[i][0]+=(dp[i-1][1]+dp[i-1][2])%bba;
        dp[i][1]+=dp[i-1][0]%bba;
        dp[i][2]+=dp[i-1][1]%bba;
    }
    long long a;
    for(int i=0;i<3;i++){
        a+=dp[n][i]%bba;
    }
    cout<<a<<endl;
}
0