Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Bob is playing a game, in which he has to fight monsters and he gains XP powers from them. Bob has special spells and he
Bob is playing a game, in which he has to fight monsters and he gains XP powers from them. Bob has special spells and he can use them as much as he want while he is still in the game.
The game has monsters, and each monster's power is less or equal than The monsters powers will be given in array of size where the value i denotes the power of monster with index
At the beginning of the game, Bob starts with monster numbered and the game ends when Bob kills all the monstersall till the monster
Bob is currently fighting monster with index i and in one operation he can:
Kill this monster and move to the next one and not earn any XP powers.
Use the spell to kill all the next monsters including monster for all and gain XP power equal to the difference between the power of the strongest monster and the power of the weakest monster maxP in range and move to the monster whose index is
Find the maximum possible XP powers that Bob can gain by using the spells optimally.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started