結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 16 ms
7,772 KB
testcase_02 AC 15 ms
7,928 KB
testcase_03 AC 17 ms
7,856 KB
testcase_04 AC 17 ms
7,764 KB
testcase_05 AC 16 ms
7,932 KB
testcase_06 AC 15 ms
7,792 KB
testcase_07 AC 16 ms
7,760 KB
testcase_08 AC 15 ms
7,928 KB
testcase_09 AC 16 ms
7,752 KB
testcase_10 AC 16 ms
7,808 KB
testcase_11 AC 16 ms
7,760 KB
testcase_12 AC 16 ms
7,852 KB
testcase_13 AC 17 ms
8,256 KB
testcase_14 AC 23 ms
8,720 KB
testcase_15 AC 29 ms
9,468 KB
testcase_16 AC 47 ms
11,596 KB
testcase_17 AC 152 ms
21,644 KB
testcase_18 AC 784 ms
72,016 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
mod=10**9+7
if n==1:
  print(1)
else:
  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]
    if D[i][1]>mod:
      D[i][1]%=mod
    D[i][2]=D[i-1][1]
  print(sum(D[-1])%mod)
0