結果

問題 No.314 ケンケンパ
ユーザー flippergoflippergo
提出日時 2020-12-28 10:12:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 967 ms / 1,000 ms
コード長 297 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 326,552 KB
最終ジャッジ日時 2024-04-10 08:44:20
合計ジャッジ時間 5,311 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 943 ms
321,032 KB
testcase_01 AC 36 ms
53,280 KB
testcase_02 AC 35 ms
52,684 KB
testcase_03 AC 36 ms
52,900 KB
testcase_04 AC 35 ms
53,552 KB
testcase_05 AC 35 ms
52,552 KB
testcase_06 AC 35 ms
52,864 KB
testcase_07 AC 35 ms
53,452 KB
testcase_08 AC 35 ms
52,752 KB
testcase_09 AC 36 ms
52,528 KB
testcase_10 AC 38 ms
58,292 KB
testcase_11 AC 40 ms
59,844 KB
testcase_12 AC 42 ms
60,188 KB
testcase_13 AC 45 ms
64,844 KB
testcase_14 AC 60 ms
77,636 KB
testcase_15 AC 64 ms
78,020 KB
testcase_16 AC 75 ms
80,160 KB
testcase_17 AC 141 ms
99,564 KB
testcase_18 AC 424 ms
193,276 KB
testcase_19 AC 967 ms
326,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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