結果

問題 No.314 ケンケンパ
ユーザー matsu7874matsu7874
提出日時 2015-12-07 00:22:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 366 ms / 1,000 ms
コード長 230 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 47,116 KB
最終ジャッジ日時 2023-10-12 18:37:49
合計ジャッジ時間 2,656 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 362 ms
46,572 KB
testcase_01 AC 16 ms
7,852 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 16 ms
7,872 KB
testcase_04 AC 16 ms
8,196 KB
testcase_05 AC 16 ms
7,944 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,852 KB
testcase_08 AC 16 ms
7,816 KB
testcase_09 AC 15 ms
7,828 KB
testcase_10 AC 16 ms
7,848 KB
testcase_11 AC 16 ms
7,816 KB
testcase_12 AC 16 ms
7,788 KB
testcase_13 AC 16 ms
8,000 KB
testcase_14 AC 17 ms
8,336 KB
testcase_15 AC 19 ms
8,312 KB
testcase_16 AC 25 ms
9,044 KB
testcase_17 AC 51 ms
11,900 KB
testcase_18 AC 188 ms
26,588 KB
testcase_19 AC 366 ms
47,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N == 1:
    print(1)
    exit()

dp = [0] * (N + 2)
dp[0] = 1
dp[1] = 1
dp[2] = 0

for i in range(1, N + 2):
    dp[i] = (dp[i - 2] + dp[i - 3]) % 1000000007
print((dp[N] + dp[N - 1] + dp[N - 2]) % 1000000007)
0