結果

問題 No.314 ケンケンパ
ユーザー 12354865271235486527
提出日時 2019-12-01 18:58:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 254 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 144,000 KB
最終ジャッジ日時 2024-05-01 10:45:05
合計ジャッジ時間 5,724 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 24 ms
10,624 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 24 ms
10,752 KB
testcase_04 AC 24 ms
10,624 KB
testcase_05 AC 24 ms
10,752 KB
testcase_06 AC 25 ms
10,752 KB
testcase_07 AC 24 ms
10,624 KB
testcase_08 AC 25 ms
10,752 KB
testcase_09 AC 25 ms
10,752 KB
testcase_10 AC 25 ms
10,752 KB
testcase_11 AC 25 ms
10,752 KB
testcase_12 AC 25 ms
10,752 KB
testcase_13 AC 27 ms
10,752 KB
testcase_14 AC 35 ms
11,392 KB
testcase_15 AC 37 ms
12,032 KB
testcase_16 AC 51 ms
14,080 KB
testcase_17 AC 127 ms
24,192 KB
testcase_18 AC 568 ms
74,496 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 10**9 + 7
dp = [[None] * 3 for _ in range(N+1)]
dp[1][0] = 0
dp[1][1] = 1
dp[1][2] = 0

for i in range(1,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(sum(dp[N]) % mod)
0