結果

問題 No.314 ケンケンパ
ユーザー flippergoflippergo
提出日時 2020-12-28 10:34:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 289 ms / 1,000 ms
コード長 244 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 169,412 KB
最終ジャッジ日時 2024-04-10 08:59:59
合計ジャッジ時間 2,706 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 275 ms
169,412 KB
testcase_01 AC 34 ms
53,168 KB
testcase_02 AC 35 ms
52,980 KB
testcase_03 AC 35 ms
52,524 KB
testcase_04 AC 35 ms
52,288 KB
testcase_05 AC 35 ms
52,196 KB
testcase_06 AC 35 ms
52,680 KB
testcase_07 AC 35 ms
52,072 KB
testcase_08 AC 36 ms
52,400 KB
testcase_09 AC 35 ms
52,932 KB
testcase_10 AC 36 ms
52,920 KB
testcase_11 AC 40 ms
58,460 KB
testcase_12 AC 40 ms
60,312 KB
testcase_13 AC 41 ms
58,780 KB
testcase_14 AC 45 ms
65,084 KB
testcase_15 AC 46 ms
67,688 KB
testcase_16 AC 55 ms
78,100 KB
testcase_17 AC 72 ms
84,764 KB
testcase_18 AC 164 ms
120,392 KB
testcase_19 AC 289 ms
169,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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