結果

問題 No.533 Mysterious Stairs
ユーザー AEnAEn
提出日時 2022-05-17 14:59:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 5,000 ms
コード長 323 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 173,576 KB
最終ジャッジ日時 2023-10-13 12:44:48
合計ジャッジ時間 4,136 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,120 KB
testcase_01 AC 60 ms
71,000 KB
testcase_02 AC 60 ms
70,968 KB
testcase_03 AC 59 ms
71,084 KB
testcase_04 AC 61 ms
71,180 KB
testcase_05 AC 62 ms
70,964 KB
testcase_06 AC 60 ms
71,156 KB
testcase_07 AC 61 ms
71,372 KB
testcase_08 AC 59 ms
71,224 KB
testcase_09 AC 61 ms
71,252 KB
testcase_10 AC 61 ms
71,112 KB
testcase_11 AC 61 ms
71,008 KB
testcase_12 AC 66 ms
76,252 KB
testcase_13 AC 66 ms
76,316 KB
testcase_14 AC 66 ms
76,308 KB
testcase_15 AC 67 ms
76,320 KB
testcase_16 AC 66 ms
76,576 KB
testcase_17 AC 67 ms
76,508 KB
testcase_18 AC 67 ms
76,340 KB
testcase_19 AC 66 ms
76,400 KB
testcase_20 AC 88 ms
88,132 KB
testcase_21 AC 90 ms
89,472 KB
testcase_22 AC 137 ms
114,848 KB
testcase_23 AC 239 ms
172,344 KB
testcase_24 AC 237 ms
173,576 KB
testcase_25 AC 88 ms
88,272 KB
testcase_26 AC 220 ms
160,536 KB
testcase_27 AC 104 ms
94,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 10**9+7
dp = [[0]*3 for _ in range(N+1)]
dp[0][0] = 1
for i in range(1, N+1):
    if i == 1:
        dp[i][0] = 1
    elif i == 2:
        dp[i][1] = 1
    else:
        for j in range(3):
            dp[i][j] = dp[i-j-1][(j+1)%3]+dp[i-j-1][(j+2)%3]
            dp[i][j] %= mod
print(sum(dp[-1])%mod)
0