結果

問題 No.533 Mysterious Stairs
ユーザー 👑 KazunKazun
提出日時 2021-02-16 18:56:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 499 ms / 5,000 ms
コード長 307 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 227,436 KB
最終ジャッジ日時 2023-10-11 09:21:46
合計ジャッジ時間 5,694 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,580 KB
testcase_01 AC 67 ms
71,404 KB
testcase_02 AC 66 ms
71,404 KB
testcase_03 AC 66 ms
71,544 KB
testcase_04 AC 67 ms
71,492 KB
testcase_05 AC 69 ms
71,548 KB
testcase_06 AC 65 ms
71,620 KB
testcase_07 AC 66 ms
71,272 KB
testcase_08 AC 66 ms
71,548 KB
testcase_09 AC 66 ms
71,560 KB
testcase_10 AC 71 ms
76,076 KB
testcase_11 AC 73 ms
76,200 KB
testcase_12 AC 74 ms
76,148 KB
testcase_13 AC 74 ms
76,348 KB
testcase_14 AC 74 ms
76,428 KB
testcase_15 AC 75 ms
76,328 KB
testcase_16 AC 76 ms
76,200 KB
testcase_17 AC 76 ms
76,212 KB
testcase_18 AC 78 ms
76,116 KB
testcase_19 AC 78 ms
76,232 KB
testcase_20 AC 123 ms
92,512 KB
testcase_21 AC 133 ms
95,832 KB
testcase_22 AC 241 ms
135,372 KB
testcase_23 AC 491 ms
226,248 KB
testcase_24 AC 499 ms
227,436 KB
testcase_25 AC 118 ms
92,604 KB
testcase_26 AC 416 ms
207,440 KB
testcase_27 AC 177 ms
115,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
Mod=10**9+7

DP=[["*",0,0,0] for _ in range(N+4)]
DP[1]=["*",1,0,0]
DP[2]=["*",0,1,0]
DP[3]=["*",0,0,1]

for i in range(1,N+1):
    for s in [1,2,3]:
        for t in [1,2,3]:
            if s!=t:
                DP[i+s][s]+=DP[i][t]
                DP[i+s][s]%=Mod

print(sum(DP[N][1:])%Mod)
0