subject
Mathematics, 19.05.2021 18:30 chloelandry

In this game, there is a stack of n bricks. The ith brick in the stack is worth v[i] points (where v[0] is the value of the top brick). The players take turns removing either 1, 2, 3 or 4 bricks from the top of the stack. The player that removes a brick earns the number of points associated with the brick. The game ends when all the bricks have been removed, and the winner is the player who has earned the most points. For example, if v = [1, 1, 3, 4] and Smoov is the first player to move, then Smoov's optimal strategy is to take just the first brick (earning 1 point). Curly's optimal strategy is then to take the next two bricks (earning 4 points). Smoov then finishes by taking the last brick (earning 4 more points). Therefore, the maximum score Smoov can earn is 5. Assume that Smoov takes the first turn and that both Smoov and Curly play optimally. Given the list v of the values of the bricks (all integers greaterthanorequalto 0), output the maximum score Smoov can earn. (a) Define the subproblems to be solved in English. Solution: Let s_i denote the optimum score for whoever's turn it is when v_i is the top remaining brick. The subproblems are to compute s_i for each i from n - 1 to 0. (b) Define an appropriate recurrence for the subproblems. Solution: s_i = {0, i greaterthanorequalto n v[i] + max (min(s_i+2, s_i+3), v[i + 1] + min(s_i+3, s_i+4)), i < n For the particular input v = [1, 2, 0, 8, 0, 3, 3, 2], compute s_i for 0 lessthanorequalto i lessthanorequalto 7.

ansver
Answers: 3

Another question on Mathematics

question
Mathematics, 21.06.2019 15:00
Saline iv fluid bags cost $64.20 for 24, 1000 ml bags from one supplier. another supplier sells 500 ml bags for $2 each. the hospital uses about 10,000, 1000 ml bags each month. nurses report that about half of the bags are more than half full when they are discarded. if you are going to use only one supplier, which would you choose and how much would you save with that choice? show calculator try it! if you buy 1000 ml bags, how many do you need to buy each month? type your answer in the space provided and click on the check answer button.
Answers: 3
question
Mathematics, 21.06.2019 15:30
Mary works for a company that ships packages and must measure the size of each box that needs to be shipped. mary measures a box and finds the length is 7 inches, the width is 14 inches, and the height is 15 inches. what is the volume of the box? [type your answer as a number.]
Answers: 1
question
Mathematics, 21.06.2019 17:30
Scrub a dub toothbrushes are $4.00 each. there is a 10% discount, but there is also a 6% sales tax after the discount is applied. what is the new price after tax? round to the nearest penny
Answers: 1
question
Mathematics, 21.06.2019 21:00
Graph the equationy= x+3[tex]y = x + 3[/tex]
Answers: 1
You know the right answer?
In this game, there is a stack of n bricks. The ith brick in the stack is worth v[i] points (where v...
Questions
question
Mathematics, 06.06.2020 11:58
question
Social Studies, 06.06.2020 11:58
question
Mathematics, 06.06.2020 12:57