結果

問題 No.314 ケンケンパ
ユーザー tnodinotnodino
提出日時 2022-06-26 12:42:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 268 ms / 1,000 ms
コード長 314 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 172,504 KB
最終ジャッジ日時 2024-04-28 04:55:22
合計ジャッジ時間 3,094 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 267 ms
171,264 KB
testcase_01 AC 41 ms
52,224 KB
testcase_02 AC 40 ms
51,840 KB
testcase_03 AC 40 ms
52,096 KB
testcase_04 AC 41 ms
51,456 KB
testcase_05 AC 40 ms
51,456 KB
testcase_06 AC 40 ms
51,456 KB
testcase_07 AC 39 ms
51,968 KB
testcase_08 AC 40 ms
53,696 KB
testcase_09 AC 40 ms
52,104 KB
testcase_10 AC 44 ms
52,888 KB
testcase_11 AC 45 ms
59,772 KB
testcase_12 AC 48 ms
61,840 KB
testcase_13 AC 52 ms
62,772 KB
testcase_14 AC 53 ms
63,092 KB
testcase_15 AC 55 ms
64,880 KB
testcase_16 AC 56 ms
65,560 KB
testcase_17 AC 81 ms
86,276 KB
testcase_18 AC 160 ms
123,204 KB
testcase_19 AC 268 ms
172,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9+7
N = int(input())
DP = [[0] * 3 for _ in range(N+1)]
DP[0][0] = 1
for i in range(N):
    for j in range(3):
        if j <= 1:
            DP[i+1][j+1] += DP[i][j]
            DP[i+1][j+1] %= mod
        if 1 <= j:
            DP[i+1][0] += DP[i][j]
            DP[i+1][0] %= mod
print(sum(DP[N])%mod)
0