結果

問題 No.44 DPなすごろく
ユーザー cocodripscocodrips
提出日時 2014-10-21 12:01:56
言語 Python2
(2.7.18)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 330 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 6,160 KB
最終ジャッジ日時 2023-08-28 22:29:43
合計ジャッジ時間 1,771 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
5,956 KB
testcase_01 AC 15 ms
5,952 KB
testcase_02 AC 15 ms
5,988 KB
testcase_03 AC 15 ms
5,896 KB
testcase_04 AC 15 ms
5,956 KB
testcase_05 AC 15 ms
5,912 KB
testcase_06 AC 14 ms
5,960 KB
testcase_07 AC 16 ms
6,064 KB
testcase_08 AC 15 ms
5,892 KB
testcase_09 AC 16 ms
6,124 KB
testcase_10 AC 14 ms
6,132 KB
testcase_11 AC 14 ms
5,904 KB
testcase_12 AC 15 ms
5,888 KB
testcase_13 AC 15 ms
6,024 KB
testcase_14 AC 15 ms
5,916 KB
testcase_15 AC 15 ms
5,972 KB
testcase_16 AC 16 ms
5,984 KB
testcase_17 AC 15 ms
5,972 KB
testcase_18 AC 15 ms
5,960 KB
testcase_19 AC 15 ms
5,992 KB
testcase_20 AC 15 ms
5,872 KB
testcase_21 AC 16 ms
5,884 KB
testcase_22 AC 14 ms
6,160 KB
testcase_23 AC 15 ms
5,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import os

def count(n, memo={}):
    if n < 0:
        return 0
    if n == 0:
        return 1
    if n in memo:
        return memo[n]

    memo[n] = count(n - 1) + count(n - 2)
    return memo[n]


if __name__ == "__main__":
    N = int(raw_input())
    print count(N)

    os.system('mkdir mkdir_shitayo')
0