Answered step by step
Verified Expert Solution
Link Copied!

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 N monsters, and each monster's power is less or equal than 10000. The monsters powers will be given in array P of size N, where the value P[i] denotes the power of monster with index i.
At the beginning of the game, Bob starts with monster numbered 1 and the game ends when Bob kills all the monsters(all till the Nth 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 J monsters including monster i, for all AJB,AB,B-A500, and gain XP power equal to the difference between the power of the strongest monster and the power of the weakest monster ( maxP[i]-) in range i,i+J-1 and move to the monster whose index is i+J.
Find the maximum possible XP powers that Bob can gain by using the spells optimally.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

List 5 to 10 effects of changing climate.

Answered: 1 week ago