結果

問題 No.533 Mysterious Stairs
ユーザー mlihua09mlihua09
提出日時 2020-09-16 02:45:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 349 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 86,780 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2023-09-04 03:14:45
合計ジャッジ時間 4,229 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,316 KB
testcase_01 AC 69 ms
71,260 KB
testcase_02 AC 70 ms
71,144 KB
testcase_03 AC 70 ms
71,192 KB
testcase_04 AC 73 ms
71,004 KB
testcase_05 AC 70 ms
71,008 KB
testcase_06 AC 70 ms
71,284 KB
testcase_07 AC 70 ms
71,312 KB
testcase_08 AC 71 ms
71,192 KB
testcase_09 AC 71 ms
71,204 KB
testcase_10 AC 69 ms
71,360 KB
testcase_11 AC 73 ms
71,128 KB
testcase_12 AC 72 ms
71,288 KB
testcase_13 AC 71 ms
71,248 KB
testcase_14 AC 71 ms
71,244 KB
testcase_15 AC 75 ms
75,904 KB
testcase_16 AC 76 ms
75,752 KB
testcase_17 AC 74 ms
75,560 KB
testcase_18 AC 74 ms
75,624 KB
testcase_19 AC 74 ms
75,652 KB
testcase_20 AC 75 ms
75,676 KB
testcase_21 AC 76 ms
75,556 KB
testcase_22 AC 78 ms
75,660 KB
testcase_23 AC 85 ms
75,648 KB
testcase_24 AC 84 ms
75,716 KB
testcase_25 AC 75 ms
75,624 KB
testcase_26 AC 83 ms
75,792 KB
testcase_27 AC 76 ms
75,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


mod = 10 ** 9 + 7
N = int(input())
if N == 1:
    print(1)
    exit()
elif N == 2:
    print(1)
    exit()
x1, x2, x3 = 1, 0, 1
y1, y2, y3 = 0, 1, 1
z1, z2, z3 = 0, 0, 1

for _ in range(N - 3):
    
    x1, x2, x3, y1, y2, y3, z1, z2, z3 = x2, x3, (y3 + z3) % mod, y2, y3, (x2 + z2) % mod, z2, z3, (x1 + y1) % mod
    
print((x3 + y3 + z3) % mod)
0