結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 998 ms
320,916 KB
testcase_01 AC 35 ms
52,904 KB
testcase_02 AC 36 ms
52,504 KB
testcase_03 AC 36 ms
53,384 KB
testcase_04 AC 36 ms
52,348 KB
testcase_05 AC 36 ms
54,104 KB
testcase_06 AC 36 ms
52,572 KB
testcase_07 AC 35 ms
52,284 KB
testcase_08 AC 36 ms
52,956 KB
testcase_09 AC 36 ms
52,640 KB
testcase_10 AC 39 ms
58,668 KB
testcase_11 AC 40 ms
60,312 KB
testcase_12 AC 42 ms
61,140 KB
testcase_13 AC 46 ms
63,864 KB
testcase_14 AC 60 ms
77,416 KB
testcase_15 AC 63 ms
77,688 KB
testcase_16 AC 75 ms
80,320 KB
testcase_17 AC 141 ms
99,408 KB
testcase_18 AC 444 ms
193,340 KB
testcase_19 AC 988 ms
326,468 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])%p+dp[N][1][1])%p)
0