結果

問題 No.533 Mysterious Stairs
ユーザー ronpooronpoo
提出日時 2023-08-29 12:47:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,393 ms / 5,000 ms
コード長 238 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 10,584 KB
実行使用メモリ 204,192 KB
最終ジャッジ日時 2023-08-29 12:48:06
合計ジャッジ時間 17,101 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,784 KB
testcase_01 AC 16 ms
7,780 KB
testcase_02 AC 15 ms
7,844 KB
testcase_03 AC 15 ms
7,880 KB
testcase_04 AC 15 ms
7,928 KB
testcase_05 AC 15 ms
7,840 KB
testcase_06 AC 15 ms
7,784 KB
testcase_07 AC 16 ms
7,764 KB
testcase_08 AC 15 ms
7,768 KB
testcase_09 AC 16 ms
7,824 KB
testcase_10 AC 16 ms
7,808 KB
testcase_11 AC 16 ms
7,876 KB
testcase_12 AC 17 ms
7,820 KB
testcase_13 AC 18 ms
8,336 KB
testcase_14 AC 19 ms
8,316 KB
testcase_15 AC 19 ms
8,336 KB
testcase_16 AC 25 ms
8,536 KB
testcase_17 AC 31 ms
9,008 KB
testcase_18 AC 38 ms
9,580 KB
testcase_19 AC 47 ms
9,916 KB
testcase_20 AC 356 ms
29,764 KB
testcase_21 AC 392 ms
32,332 KB
testcase_22 AC 1,265 ms
83,252 KB
testcase_23 AC 3,393 ms
201,856 KB
testcase_24 AC 3,383 ms
204,192 KB
testcase_25 AC 352 ms
30,000 KB
testcase_26 AC 2,845 ms
177,040 KB
testcase_27 AC 807 ms
57,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
MOD = 10**9 + 7
dp = [[0]*4 for _ in range(N+10)]
dp[0][0] = 1
for i in range(N):
    for j in range(1, 4):
        dp[i+j][j] += sum(dp[i]) - dp[i][j]
        dp[i+j][j] %= MOD
        
ans = sum(dp[N]) % MOD
print(ans)
0