結果

問題 No.314 ケンケンパ
ユーザー takakintakakin
提出日時 2020-03-30 17:45:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 258 bytes
コンパイル時間 1,062 ms
コンパイル使用メモリ 10,752 KB
実行使用メモリ 141,540 KB
最終ジャッジ日時 2023-09-04 05:35:13
合計ジャッジ時間 7,001 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 17 ms
7,780 KB
testcase_02 AC 17 ms
7,904 KB
testcase_03 AC 17 ms
7,832 KB
testcase_04 RE -
testcase_05 AC 17 ms
7,900 KB
testcase_06 AC 17 ms
7,840 KB
testcase_07 AC 16 ms
7,768 KB
testcase_08 AC 17 ms
7,776 KB
testcase_09 AC 17 ms
7,844 KB
testcase_10 AC 17 ms
7,832 KB
testcase_11 AC 17 ms
7,820 KB
testcase_12 AC 17 ms
7,768 KB
testcase_13 AC 18 ms
8,316 KB
testcase_14 AC 25 ms
8,848 KB
testcase_15 AC 29 ms
9,452 KB
testcase_16 AC 47 ms
11,676 KB
testcase_17 AC 138 ms
21,524 KB
testcase_18 AC 710 ms
72,012 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
mod=10**9+7
D=[[0]*3 for _ in range(n)]
D[1][0]=1
D[1][1]=1
D[1][2]=0
for i in range(2,n):
  D[i][0]=D[i-1][2]
  D[i][1]=(D[i-1][0]+D[i-1][2])%mod
  D[i][2]=D[i-1][1]
print(sum(D[-1])%mod)
0