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]- min P[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 Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions