結果

問題 No.314 ケンケンパ
ユーザー AEnAEn
提出日時 2022-05-13 16:17:31
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 354 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 345,780 KB
最終ジャッジ日時 2023-09-28 20:31:40
合計ジャッジ時間 6,714 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 76 ms
71,116 KB
testcase_02 AC 75 ms
71,300 KB
testcase_03 AC 75 ms
71,328 KB
testcase_04 AC 75 ms
71,324 KB
testcase_05 AC 76 ms
71,344 KB
testcase_06 AC 76 ms
71,412 KB
testcase_07 AC 76 ms
71,432 KB
testcase_08 AC 76 ms
71,284 KB
testcase_09 AC 75 ms
71,416 KB
testcase_10 AC 75 ms
71,220 KB
testcase_11 AC 76 ms
70,952 KB
testcase_12 AC 79 ms
74,992 KB
testcase_13 AC 82 ms
75,680 KB
testcase_14 AC 88 ms
76,596 KB
testcase_15 AC 90 ms
76,572 KB
testcase_16 AC 104 ms
81,068 KB
testcase_17 AC 170 ms
102,708 KB
testcase_18 AC 463 ms
202,156 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 10**9+7

dp = [[[0]*3 for _ in range(2)] for _ in range(N)]
dp[0][0][1] = 1
for i in range(1, N):
    dp[i][0][1] += dp[i-1][1][0]
    dp[i][0][2] += dp[i-1][0][1]
    dp[i][1][0] += dp[i-1][0][2]+dp[i-1][0][1]
    dp[i][0][1] %= mod
    dp[i][0][2] %= mod
    dp[i][1][0] %= mod
print((dp[-1][0][1]+dp[-1][0][2]+dp[-1][1][0])%mod)
0