結果

問題 No.314 ケンケンパ
ユーザー c_r_5c_r_5
提出日時 2018-09-18 22:03:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 469 ms / 1,000 ms
コード長 262 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 171,904 KB
最終ジャッジ日時 2023-09-25 09:56:13
合計ジャッジ時間 5,407 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 442 ms
170,292 KB
testcase_01 AC 69 ms
71,208 KB
testcase_02 AC 68 ms
71,256 KB
testcase_03 AC 67 ms
70,900 KB
testcase_04 AC 69 ms
71,168 KB
testcase_05 AC 69 ms
71,060 KB
testcase_06 AC 70 ms
70,896 KB
testcase_07 AC 70 ms
71,092 KB
testcase_08 AC 70 ms
70,892 KB
testcase_09 AC 70 ms
71,180 KB
testcase_10 AC 73 ms
71,068 KB
testcase_11 AC 74 ms
75,040 KB
testcase_12 AC 76 ms
76,204 KB
testcase_13 AC 82 ms
76,316 KB
testcase_14 AC 82 ms
76,428 KB
testcase_15 AC 87 ms
76,576 KB
testcase_16 AC 95 ms
78,832 KB
testcase_17 AC 126 ms
86,540 KB
testcase_18 AC 272 ms
122,484 KB
testcase_19 AC 469 ms
171,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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