結果

問題 No.533 Mysterious Stairs
ユーザー first_vilfirst_vil
提出日時 2020-07-16 12:07:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 418 ms / 5,000 ms
コード長 284 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 180,712 KB
最終ジャッジ日時 2024-05-03 11:57:44
合計ジャッジ時間 3,844 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,012 KB
testcase_01 AC 36 ms
53,292 KB
testcase_02 AC 36 ms
53,024 KB
testcase_03 AC 35 ms
52,128 KB
testcase_04 AC 37 ms
52,076 KB
testcase_05 AC 36 ms
53,444 KB
testcase_06 AC 36 ms
52,536 KB
testcase_07 AC 36 ms
52,344 KB
testcase_08 AC 38 ms
52,128 KB
testcase_09 AC 36 ms
52,660 KB
testcase_10 AC 41 ms
61,044 KB
testcase_11 AC 44 ms
62,540 KB
testcase_12 AC 44 ms
61,620 KB
testcase_13 AC 45 ms
61,680 KB
testcase_14 AC 46 ms
62,276 KB
testcase_15 AC 46 ms
62,356 KB
testcase_16 AC 47 ms
63,188 KB
testcase_17 AC 47 ms
64,032 KB
testcase_18 AC 47 ms
64,344 KB
testcase_19 AC 48 ms
64,756 KB
testcase_20 AC 92 ms
88,156 KB
testcase_21 AC 96 ms
89,568 KB
testcase_22 AC 189 ms
116,848 KB
testcase_23 AC 413 ms
179,232 KB
testcase_24 AC 418 ms
180,712 KB
testcase_25 AC 92 ms
88,420 KB
testcase_26 AC 373 ms
166,544 KB
testcase_27 AC 148 ms
103,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
n=int(input())
dp=[[0]*4 for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
    for j in range(1,4):
        if i<j:
            continue
        for k in range(0,4):
            if j!=k:
                dp[i][j]+=dp[i-j][k]
        dp[i][j]%=mod
print(sum(dp[n])%mod)
0