結果

問題 No.314 ケンケンパ
ユーザー asumo0729asumo0729
提出日時 2020-12-20 18:19:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 493 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,800 KB
実行使用メモリ 75,272 KB
最終ジャッジ日時 2023-10-21 10:53:03
合計ジャッジ時間 2,250 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
75,272 KB
testcase_01 AC 59 ms
75,272 KB
testcase_02 AC 60 ms
75,272 KB
testcase_03 AC 58 ms
75,272 KB
testcase_04 AC 57 ms
75,272 KB
testcase_05 AC 56 ms
75,272 KB
testcase_06 AC 59 ms
75,272 KB
testcase_07 AC 56 ms
75,272 KB
testcase_08 AC 57 ms
75,272 KB
testcase_09 AC 56 ms
75,272 KB
testcase_10 AC 56 ms
75,272 KB
testcase_11 AC 59 ms
75,272 KB
testcase_12 AC 58 ms
75,272 KB
testcase_13 AC 58 ms
75,272 KB
testcase_14 AC 56 ms
75,272 KB
testcase_15 AC 58 ms
75,272 KB
testcase_16 AC 57 ms
75,272 KB
testcase_17 AC 55 ms
75,272 KB
testcase_18 AC 57 ms
75,272 KB
testcase_19 AC 57 ms
75,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
stdin=sys.stdin

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
tp=lambda:tuple(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
yp=lambda:print('Yes')
np=lambda:print('No')

n=ip()
mod=10**9+7
dp0=[0 for _ in range(10**6+10)]
dp1=[0 for _ in range(10**6+10)]
dp0[1]=1
dp1[1]=0
dp0[2]=1
dp1[2]=1
for  i in range(3,10**6+10):
    dp0[i]+=dp1[i-1]+(dp1[i-2])%mod
    dp1[i]+=dp0[i-1]%mod

print((dp0[n]+dp1[n])%mod)
0