In-jae, did you catch Mushmom?
Time limit1sMemory limit256 MB
Given In-jae's health A and attack B and Mushmom's health X and attack Y, find the fewest actions In-jae needs to defeat Mushmom.
- Level
Medium6 of 10
- Topics
- Simulation, Shortest path
- Solved
- No attempts yet
Problem
In-jae spent a year failing to defeat an orange mushroom, and now he sets out on an adventure to settle things with Mushmom.
In-jae has health and attack . Mushmom has health and attack .
In-jae attacks first. The two take turns, and each may take one action per turn.
There are only three kinds of action.
- Attack: deals damage equal to the current attack.
- Counter: takes no damage this turn and deals damage equal to the opponent's attack. Health increases by 10% of the current health. Discard any fraction.
- Buff: raises the current attack by 20% and triples the damage taken this turn only. Discard any fraction.
Mushmom can only attack.
Help In-jae find the way to hunt Mushmom in as few turns as possible.
Input
On the first line, input In-jae's health and attack , then Mushmom's health and attack , in that order.
(, )
Output
On the first line, print the number of actions In-jae takes when Mushmom is hunted in the fewest possible actions.