結果

問題 No.314 ケンケンパ
ユーザー TsubasaTsubasa
提出日時 2018-02-02 20:47:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 295 ms / 1,000 ms
コード長 229 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 16,304 KB
最終ジャッジ日時 2023-08-30 01:54:40
合計ジャッジ時間 2,661 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 294 ms
16,264 KB
testcase_01 AC 19 ms
8,676 KB
testcase_02 AC 19 ms
8,560 KB
testcase_03 AC 20 ms
8,460 KB
testcase_04 AC 19 ms
8,456 KB
testcase_05 AC 19 ms
8,524 KB
testcase_06 AC 19 ms
8,572 KB
testcase_07 AC 19 ms
8,456 KB
testcase_08 AC 20 ms
8,652 KB
testcase_09 AC 20 ms
8,496 KB
testcase_10 AC 19 ms
8,504 KB
testcase_11 AC 19 ms
8,660 KB
testcase_12 AC 19 ms
8,592 KB
testcase_13 AC 20 ms
8,516 KB
testcase_14 AC 21 ms
8,744 KB
testcase_15 AC 22 ms
8,596 KB
testcase_16 AC 27 ms
8,788 KB
testcase_17 AC 47 ms
9,192 KB
testcase_18 AC 153 ms
12,376 KB
testcase_19 AC 295 ms
16,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import array

def main():
  dp = array.array("Q", [1,2,2])
  mod = 10**9 + 7
  N = int(input())

  if N <= 3:
    print(dp[N-1])
    return

  for n in range(3, N):
    dp.append((dp[n-3]+dp[n-2]) % mod)

  print(dp[-1])

main()
0