結果

問題 No.533 Mysterious Stairs
ユーザー RyuRyu
提出日時 2018-01-05 08:00:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 67,992 KB
実行使用メモリ 18,952 KB
最終ジャッジ日時 2023-08-24 19:57:53
合計ジャッジ時間 1,649 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 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 AC 1 ms
4,380 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>

using namespace std;
const int MOD = 1e9 + 7;


int dp[1000001][4];
int main()
{
    int n;
    cin >> n;

    dp[0][0] = 1;

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 4; j++)
        {
            for(int k = 1; k < 4; k++)
            {
                if(k != j)
                    dp[i + k][k] += dp[i][j] % MOD;
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < 4; i++)
        ans += dp[n][i] % MOD;

    cout << ans << endl;
}

0