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:30
Is each relation a function? if so, state whether it is one-to-one or many-to-one. 3. (-4,7), (-3,5), (1,4), (3,-8), (5,-11) 4. (-4,8), (-2,4), (0,1), (2,4), (4,8) 5. (-2, 1), (-2,3), (0,-3), (1,4), (3,1)
Answers: 3
question
Mathematics, 21.06.2019 17:40
The weight of full–grown tomatoes at a farm is modeled by a normal distribution with a standard deviation of 18.4 grams. the 95 percent confidence interval for the mean weight of the tomatoes is calculated using a sample of 100 tomatoes. what is the margin of error (half the width of the confidence interval)?
Answers: 2
question
Mathematics, 21.06.2019 21:30
X/y + 4y/x divided by x/y - 2y/x explain as in depth as you can how you simplfied the fractions. i don't know where to start on this : /
Answers: 3
question
Mathematics, 22.06.2019 00:00
Margaret is purchasing a house for $210,000 with a 15 year fixed rate mortgage at 4.75% interest she has made a 5% down payment the house is valued at 205,000 and the local tax rate is 3.5% homeowners insurance 600 per year what are her total monthly payment
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
Arts, 09.12.2020 01:30
Questions on the website: 13722367