結果

問題 No.314 ケンケンパ
ユーザー tnodinotnodino
提出日時 2023-07-09 18:22:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 240 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 10,656 KB
実行使用メモリ 141,676 KB
最終ジャッジ日時 2023-09-30 21:52:43
合計ジャッジ時間 5,798 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 16 ms
7,960 KB
testcase_02 AC 16 ms
7,776 KB
testcase_03 AC 16 ms
7,800 KB
testcase_04 AC 16 ms
7,820 KB
testcase_05 AC 16 ms
7,912 KB
testcase_06 AC 15 ms
7,944 KB
testcase_07 AC 16 ms
7,740 KB
testcase_08 AC 15 ms
7,848 KB
testcase_09 AC 15 ms
7,772 KB
testcase_10 AC 15 ms
7,816 KB
testcase_11 AC 16 ms
7,736 KB
testcase_12 AC 16 ms
7,952 KB
testcase_13 AC 16 ms
8,288 KB
testcase_14 AC 21 ms
8,816 KB
testcase_15 AC 25 ms
9,452 KB
testcase_16 AC 40 ms
11,640 KB
testcase_17 AC 118 ms
21,644 KB
testcase_18 AC 612 ms
72,048 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9+7
N = int(input())
DP = [[0] * 3 for _ in range(N+1)]
DP[0][0] = 1
for i in range(N):
    DP[i+1][0] = (DP[i][1] + DP[i][2]) % mod
    DP[i+1][1] = DP[i][0]
    DP[i+1][2] = DP[i][1]
print((DP[N][0] + DP[N][1] + DP[N][2]) % mod)
0