結果

問題 No.314 ケンケンパ
ユーザー matsu7874matsu7874
提出日時 2015-12-07 00:22:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 236 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 47,300 KB
最終ジャッジ日時 2023-10-12 18:36:36
合計ジャッジ時間 3,274 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 367 ms
46,548 KB
testcase_01 AC 15 ms
8,008 KB
testcase_02 AC 16 ms
7,836 KB
testcase_03 AC 16 ms
7,820 KB
testcase_04 WA -
testcase_05 AC 15 ms
8,244 KB
testcase_06 AC 16 ms
7,736 KB
testcase_07 AC 16 ms
7,792 KB
testcase_08 AC 16 ms
7,768 KB
testcase_09 AC 16 ms
7,768 KB
testcase_10 AC 16 ms
7,816 KB
testcase_11 AC 16 ms
7,900 KB
testcase_12 AC 16 ms
7,780 KB
testcase_13 AC 16 ms
7,804 KB
testcase_14 AC 18 ms
8,336 KB
testcase_15 AC 19 ms
8,244 KB
testcase_16 AC 25 ms
9,212 KB
testcase_17 AC 51 ms
12,032 KB
testcase_18 AC 185 ms
26,792 KB
testcase_19 AC 370 ms
47,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N < 3:
    print('122'[N])
    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