結果

問題 No.314 ケンケンパ
ユーザー fmhrfmhr
提出日時 2015-12-07 10:39:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 413 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 86,440 KB
最終ジャッジ日時 2023-10-12 19:53:52
合計ジャッジ時間 4,925 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 15 ms
7,812 KB
testcase_02 AC 15 ms
7,836 KB
testcase_03 AC 15 ms
7,764 KB
testcase_04 AC 15 ms
7,752 KB
testcase_05 AC 15 ms
7,796 KB
testcase_06 AC 15 ms
7,840 KB
testcase_07 AC 15 ms
7,896 KB
testcase_08 AC 16 ms
7,836 KB
testcase_09 AC 15 ms
7,836 KB
testcase_10 AC 16 ms
7,796 KB
testcase_11 AC 16 ms
7,756 KB
testcase_12 AC 15 ms
7,812 KB
testcase_13 AC 17 ms
7,840 KB
testcase_14 AC 21 ms
8,684 KB
testcase_15 AC 26 ms
8,832 KB
testcase_16 AC 40 ms
9,836 KB
testcase_17 AC 116 ms
16,028 KB
testcase_18 AC 509 ms
45,664 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:utf-8

p = 10**9+7
N = int(input())
dp = [0]*(N+10)
dp[0] = 1
dp[1] = 2
dp[2] = 2
pa_point = [0]*(N+10)
pa_point[1] = 1
pa_point[2] = 1
pa_point[3] = 1
pa_point[4] = 2
pa_point[5] = 1
for i in range(3, N):
    # パから2つめで2分岐する
    dp[i] = (dp[i-1]+pa_point[i-2])%p
    pa_point[i+2] = (pa_point[i+2]+pa_point[i])%p
    pa_point[i+3] = (pa_point[i+3]+pa_point[i])%p
print(dp[N-1]%p)
0