結果

問題 No.314 ケンケンパ
ユーザー takakintakakin
提出日時 2020-03-30 17:47:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 335 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 144,000 KB
最終ジャッジ日時 2024-06-22 05:07:47
合計ジャッジ時間 7,145 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 25 ms
10,752 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 27 ms
10,624 KB
testcase_07 AC 25 ms
10,752 KB
testcase_08 AC 25 ms
10,624 KB
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 25 ms
10,752 KB
testcase_11 AC 26 ms
10,624 KB
testcase_12 AC 26 ms
10,624 KB
testcase_13 AC 26 ms
10,752 KB
testcase_14 AC 33 ms
11,520 KB
testcase_15 AC 40 ms
11,904 KB
testcase_16 AC 57 ms
14,208 KB
testcase_17 AC 156 ms
24,064 KB
testcase_18 AC 729 ms
74,496 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