結果

問題 No.23 技の選択
コンテスト
ユーザー nsd_fb
提出日時 2015-02-20 13:42:58
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 103 ms / 5,000 ms
+ 338µs
コード長 463 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 67 ms
コンパイル使用メモリ 80,768 KB
実行使用メモリ 86,272 KB
最終ジャッジ日時 2026-07-17 10:11:46
合計ジャッジ時間 4,143 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
import functools

sys.setrecursionlimit(10000)

def memoize(obj):
    cache = obj.cache = {}

    @functools.wraps(obj)
    def memoizer(*args, **kwargs):
        if args not in cache:
            cache[args] = obj(*args, **kwargs)
        return cache[args]
    return memoizer

@memoize
def dfs(rest):
    if rest <= 0:
        return 0.0

    return min(dfs(rest - A) + 1, dfs(rest - D) + 1.5)


H, A, D = map(int, raw_input().split())
print dfs(H)
0