結果

問題 No.314 ケンケンパ
ユーザー momotaros300momotaros300
提出日時 2019-08-25 01:31:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 1,000 ms
コード長 202 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,116 KB
実行使用メモリ 171,520 KB
最終ジャッジ日時 2024-04-22 15:37:30
合計ジャッジ時間 2,387 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
170,808 KB
testcase_01 AC 34 ms
51,712 KB
testcase_02 AC 35 ms
51,840 KB
testcase_03 AC 36 ms
52,352 KB
testcase_04 AC 34 ms
52,224 KB
testcase_05 AC 35 ms
51,712 KB
testcase_06 AC 37 ms
51,968 KB
testcase_07 AC 35 ms
51,840 KB
testcase_08 AC 36 ms
51,840 KB
testcase_09 AC 35 ms
51,968 KB
testcase_10 AC 36 ms
51,968 KB
testcase_11 AC 36 ms
52,224 KB
testcase_12 AC 36 ms
52,224 KB
testcase_13 AC 35 ms
52,684 KB
testcase_14 AC 41 ms
59,648 KB
testcase_15 AC 40 ms
59,920 KB
testcase_16 AC 43 ms
61,824 KB
testcase_17 AC 44 ms
68,864 KB
testcase_18 AC 122 ms
120,688 KB
testcase_19 AC 202 ms
171,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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