結果

問題 No.314 ケンケンパ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-01-04 21:04:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 396 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 11,784 KB
実行使用メモリ 10,416 KB
最終ジャッジ日時 2023-10-19 15:07:45
合計ジャッジ時間 1,753 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 29 ms
10,052 KB
testcase_02 AC 28 ms
10,052 KB
testcase_03 AC 27 ms
10,052 KB
testcase_04 AC 27 ms
10,052 KB
testcase_05 AC 27 ms
10,052 KB
testcase_06 AC 28 ms
10,052 KB
testcase_07 AC 27 ms
10,052 KB
testcase_08 AC 27 ms
10,052 KB
testcase_09 AC 27 ms
10,052 KB
testcase_10 AC 28 ms
10,092 KB
testcase_11 AC 31 ms
10,176 KB
testcase_12 AC 28 ms
10,224 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import functools

MODULUS = 10 ** 9 + 7


@functools.lru_cache(maxsize=None)
def count_courses(n):
    if n == 1:
        return 1
    elif n == 2:
        return 2
    elif n == 3:
        return 2
    else:
        return (count_courses(n - 2) + count_courses(n - 3)) % MODULUS


if __name__ == "__main__":
    print(count_courses(int(input())))
0