1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
UkoKoshka [18]
2 years ago
10

Mustafa wants to cross a dungeon. The dungeon has n cells, and in every cell, there are m monsters. To cross each cell he has to

kill one monster, on killing the monster, he loses the strength equal to that of the monster and gains some confidence which adds up to his strength and he proceeds to the next cell. Mustafa can only kill a monster if his strength is greater than or equal to the strength of the monster. Help him find the minimum strength he must have in the beginning so that he can cross n cells.
Mathematics
1 answer:
VladimirAG [237]2 years ago
4 0

The minimum strength he must have in the beginning so that he can cross n cells is gotten from; Strength[n - 1] = min_i Energy[n-1] [i]

How to create an Algorithm?

Let us call Energy [N][M]) the energy needed to kill each monster, and Conf [N][M] the associated confidence.

Let us call Stren[N] the minimum energy that you will need to pass each cell.

We need to select the good monster at each step. The issue is that at first cell for example, you cannot make the good decision without considering all the next cells. A DP solution or a DFS one will certainly work. However, the complexity would be quite high.

Thus using a greedy solution at the condition to start from the end would be the best thing to do.

At the last cell, the needed strength is easily calculated:

Strength[n - 1] = min_i Energy[n-1] [i]

The next strengths are then iteratively calculated, from back to the top:

​ Strength[j] = min_i (Energy[j][i], Energy[j][i] - Conf[j][i] + Strength[j+1]) For all j

Final result: Strength[0]

Complexity: linear O(NM). Impossible to do better as you have to consider each monster.

Read more about Creating Algorithms at; brainly.com/question/13800096

#SPJ1

You might be interested in
4x = 3/7 I really need help
kakasveta [241]
To solve this problem, we need to simplify.

4x = 3/7
x = 3/7 ÷ 4
x = 12/7
x = 1 5/

Hope this helps!
7 0
3 years ago
Z-31=16??? I just got into the Z section in algebra and my teacher gave us a paper with no explanation plz help ty!
cluponka [151]

Answer:z=47

Step-by-step explanation:

You're doing this because if you have z-31=16 you have to + 31 to 16 which would give you 47 then that would be a one step equation

z-31=16

you would make a line between the equal sign so it is organized then plus 31 to sixteen then that would get you to 47

8 0
3 years ago
Identify the constant term in this expression 7p - 3p + 9 + x
ANEK [815]

Answer:

the constant in this expression is 9 because it is not a coefficient of any variable

7 0
3 years ago
Read 2 more answers
What is m∠D?<br><br> m∠D = °
Alex Ar [27]

Answer:

angle d would be 63 degrees since angle B and A would form a same side interior angle, which adds to 180 so angle A has to be 117. angle D also forms a same side interior with angle A, so 180-117=63.

4 0
3 years ago
Read 2 more answers
There are 2.54 centimeters in an 1 inch. how many centimeters are 17 inches
Tpy6a [65]
43.18 would be your answer. :D
4 0
3 years ago
Read 2 more answers
Other questions:
  • Whats the approximate area of a segment of a circle with a height 6m and the lenght of the chord is 20m
    12·1 answer
  • What is 70,030,000 in scientific notation
    8·1 answer
  • Can someone give me a hand
    9·1 answer
  • Find the new amount. 50 points decreased by 26% is points.
    7·2 answers
  • PLEASE HELP!!!
    12·2 answers
  • The gasoline gauge on a truck reads 1/8 full. after you add 30 gallons the gauge reads 3/4 full. what is the capacity of the tan
    14·1 answer
  • The table shows the measured amount of a medication
    13·1 answer
  • Classify the triangle with angles with measures 20°, 133°, and 27° as acute, right, or obtuse. Please help will give 24 pts
    12·1 answer
  • I don’t understand can you please explain how you got this answer my answer keep being low than these
    8·1 answer
  • Is there someone online who can answer my statistics questions
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!