結果

問題 No.533 Mysterious Stairs
ユーザー pluto77pluto77
提出日時 2017-07-22 09:12:49
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 299 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 212,864 KB
最終ジャッジ日時 2024-04-17 15:25:06
合計ジャッジ時間 8,511 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 10 ms
6,144 KB
testcase_03 AC 11 ms
6,272 KB
testcase_04 AC 11 ms
6,144 KB
testcase_05 AC 11 ms
6,272 KB
testcase_06 AC 10 ms
6,144 KB
testcase_07 AC 10 ms
6,272 KB
testcase_08 AC 10 ms
6,144 KB
testcase_09 AC 11 ms
6,144 KB
testcase_10 AC 10 ms
6,144 KB
testcase_11 AC 11 ms
6,272 KB
testcase_12 AC 14 ms
6,272 KB
testcase_13 AC 11 ms
6,528 KB
testcase_14 AC 11 ms
6,400 KB
testcase_15 AC 12 ms
6,528 KB
testcase_16 AC 14 ms
6,784 KB
testcase_17 AC 18 ms
7,168 KB
testcase_18 AC 22 ms
7,808 KB
testcase_19 AC 25 ms
8,192 KB
testcase_20 AC 185 ms
28,928 KB
testcase_21 AC 199 ms
31,616 KB
testcase_22 AC 673 ms
85,248 KB
testcase_23 AC 1,801 ms
210,432 KB
testcase_24 AC 1,873 ms
212,864 KB
testcase_25 AC 182 ms
29,312 KB
testcase_26 AC 1,541 ms
184,192 KB
testcase_27 AC 403 ms
58,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_533

mod=10**9+7
n=int(raw_input())
dp=[[0 for i in xrange(3)] for j in xrange(n+1)]
dp[1][0]=dp[2][1]=dp[3][0]=dp[3][1]=dp[3][2]=1
for i in xrange(4,n+1):
 dp[i][0]=(dp[i-1][1]+dp[i-1][2])%mod
 dp[i][1]=(dp[i-2][0]+dp[i-2][2])%mod
 dp[i][2]=(dp[i-3][0]+dp[i-3][1])%mod
print (sum(dp[n]))%mod
0