結果

問題 No.533 Mysterious Stairs
ユーザー titiatitia
提出日時 2024-02-12 00:08:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 31,380 KB
最終ジャッジ日時 2024-02-12 00:08:54
合計ジャッジ時間 13,227 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 28 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 29 ms
9,984 KB
testcase_04 AC 28 ms
9,984 KB
testcase_05 AC 28 ms
9,984 KB
testcase_06 AC 27 ms
9,984 KB
testcase_07 AC 27 ms
9,984 KB
testcase_08 AC 29 ms
9,984 KB
testcase_09 AC 28 ms
9,984 KB
testcase_10 AC 29 ms
9,984 KB
testcase_11 AC 29 ms
9,984 KB
testcase_12 AC 32 ms
9,984 KB
testcase_13 AC 31 ms
9,984 KB
testcase_14 AC 31 ms
9,984 KB
testcase_15 AC 31 ms
10,112 KB
testcase_16 AC 36 ms
10,240 KB
testcase_17 AC 47 ms
10,624 KB
testcase_18 AC 66 ms
10,880 KB
testcase_19 AC 84 ms
11,136 KB
testcase_20 AC 4,960 ms
23,296 KB
testcase_21 TLE -
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