結果

問題 No.533 Mysterious Stairs
ユーザー titiatitia
提出日時 2024-02-12 00:09:46
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 90,888 KB
最終ジャッジ日時 2024-02-12 00:09:54
合計ジャッジ時間 8,373 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 37 ms
53,460 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 38 ms
53,460 KB
testcase_15 AC 46 ms
61,988 KB
testcase_16 AC 50 ms
61,988 KB
testcase_17 AC 60 ms
64,036 KB
testcase_18 AC 79 ms
68,132 KB
testcase_19 AC 94 ms
72,228 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

mod=10**9+7

N=int(input())

DPA=[0]*(N+100)
DPB=[0]*(N+100)
DPC=[0]*(N+100)

DPA[1]=1
DPB[2]=1
DPC[3]=1

for i in range(N):
    DPB[i+2]+=DPA[i]
    DPC[i+3]+=DPA[i]

    DPA[i+1]+=DPB[i]
    DPC[i+3]+=DPB[i]

    DPA[i+1]+=DPC[i]
    DPB[i+2]+=DPC[i]

    DPA[i]%=mod
    DPB[i]%=mod
    DPC[i]%=mod

print((DPA[N]+DPB[N]+DPC[N])%mod)
0