結果

問題 No.598 オーバーフローファンタジー
ユーザー koromooo_
提出日時 2017-11-24 23:08:37
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 458 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 7,076 KB
実行使用メモリ 13,636 KB
最終ジャッジ日時 2024-11-27 07:59:08
合計ジャッジ時間 19,812 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 1 TLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
hp = input()
attack = input()
heal = input()

def kill_by_attack(hp,attack):
    time = 0
    while True:
        if(hp < 0):
            return time
        hp -= attack
        time += 1

def kill_by_heal(n,hp,heal):
    time = 0
    over_flow_hp = 2 ** n - 2 ** (n - 1) - 1
    while True:
        if(hp > over_flow_hp):
            return time
        hp += heal
        time += 1

print min(kill_by_attack(hp,attack),kill_by_heal(n,hp,heal))
0