C. Kill the Monster
Monocarp is playing a computer game. In this game, his character fights different monsters.
A fight between a character and a monster goes as follows. Suppose the character initially has health
- the character attacks the monster, decreasing the monster's health by
dC ; - the monster attacks the character, decreasing the character's health by
dM ; - the character attacks the monster, decreasing the monster's health by
dC ; - the monster attacks the character, decreasing the character's health by
dM ; - and so on, until the end of the fight.
The fight ends when someone's health becomes non-positive (i. e.
Monocarp's character currently has health equal to
Can Monocarp's character slay the monster if Monocarp spends coins on upgrades optimally?
The first line contains one integer
The first line contains two integers
The second line contains two integers
The third line contains three integers
The sum of
For each test case, print YES if it is possible to slay the monster by optimally choosing the upgrades. Otherwise, print
In the first example, Polycarp can spend one coin to upgrade weapon (damage will be equal to
In the second example, Polycarp has no way to defeat the monster.
In the third example, Polycarp has no coins, so he can't buy upgrades. However, the initial characteristics are enough for Polycarp to win.
In the fourth example, Polycarp has
No comments:
Post a Comment