RPG Master Oh Myeongjin
Time limit0.3sMemory limit512 MB
Simulate a turn-based fight between a hero and a demon lord whose HP triggers a one-time heal of S when it falls between 1 and P, and report whether the hero wins.
- Level
Medium4 of 10
- Topics
- Simulation, Implementation, Math, Brute force
- Solved
- No attempts yet
Problem
Myeongjin, a student in the School of Software, has been playing games these days to follow quarantine rules. Having cleared every RPG, Myeongjin decides to build an RPG himself. The game is a battle between a hero and a demon lord. The hero and the demon lord each have an attack power (ATK) and health (HP). To keep the game from becoming monotonous, Myeongjin gave the demon lord a skill. When the demon lord's HP drops to between 1 and P inclusive, it recovers S HP once! Myeongjin's game proceeds as follows.
- The demon lord's HP is reduced by the hero's ATK.
- If the demon lord's HP is 0 or less, the hero wins and the game ends.
- The hero's HP is reduced by the demon lord's ATK.
- If the hero's HP is 0 or less, the hero loses and the game ends.
- If the demon lord's HP is between 1 and P inclusive, it recovers S HP.
- Steps (1~5) repeat until the game ends.
Myeongjin wants to test the difficulty of the game he made. Help Myeongjin, who is exhausted from building the game, by writing a program that tells whether the hero can defeat the demon lord!
Input
The first line gives HPhero, ATKhero, HPdemon, ATKdemon.
The hero's and the demon lord's HP and ATK are natural numbers no greater than 2^31 - 1.
The second line gives the HP threshold P (1 ≤ P < HPdemon) at which the demon lord's skill triggers, and the recovery amount S (1 ≤ S ≤ HPdemon).
Output
On the first line, print whether the hero wins.
If the hero wins, print "Victory!"; if the hero loses, print "gg".