結果

問題 No.533 Mysterious Stairs
ユーザー kokoa1046kokoa1046
提出日時 2017-10-03 15:19:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,152 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 128,348 KB
最終ジャッジ日時 2024-04-27 22:42:52
合計ジャッジ時間 5,817 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,624 KB
testcase_01 AC 27 ms
10,624 KB
testcase_02 AC 26 ms
10,624 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 27 ms
10,624 KB
testcase_05 AC 24 ms
10,880 KB
testcase_06 AC 23 ms
10,624 KB
testcase_07 AC 23 ms
10,624 KB
testcase_08 AC 23 ms
10,624 KB
testcase_09 AC 24 ms
10,752 KB
testcase_10 AC 24 ms
10,752 KB
testcase_11 AC 23 ms
10,624 KB
testcase_12 AC 24 ms
10,752 KB
testcase_13 AC 26 ms
10,752 KB
testcase_14 AC 25 ms
10,752 KB
testcase_15 AC 25 ms
10,752 KB
testcase_16 AC 26 ms
11,008 KB
testcase_17 AC 29 ms
11,520 KB
testcase_18 AC 39 ms
11,776 KB
testcase_19 AC 37 ms
12,032 KB
testcase_20 AC 145 ms
23,768 KB
testcase_21 AC 162 ms
25,436 KB
testcase_22 AC 430 ms
55,772 KB
testcase_23 AC 1,151 ms
126,812 KB
testcase_24 AC 1,152 ms
128,348 KB
testcase_25 AC 137 ms
24,028 KB
testcase_26 AC 989 ms
111,968 KB
testcase_27 AC 297 ms
40,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def twoDimArray(row,column,n): return [[n for j in range(column)] for i in range(row)]
n = int(input())
div = 10**9 + 7
if n <= 1:
    print(1)
    exit()
elif n == 2:
    print(1)
    exit()

t1 = [0, 1, 0,1]
t2 = [0, 0, 1,1]
t3 = [0, 0, 0,1]

for i in range(4, n + 1):
    t1.append((t2[i - 1] + t3[i - 1]) % div)
    t2.append((t1[i - 2] + t3[i - 2]) % div)
    t3.append((t1[i - 3] + t2[i - 3]) % div)

print((t1[-1] + t2[-1] + t3[-1]) % div)
0