Skip to content
Related Articles

Related Articles

GATE | GATE CS 2021 | Set 1 | Question 50
  • Last Updated : 23 Mar, 2021

Define Rn to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For i>0, let p[i] denote the selling price of a rod whose length is i meters. Consider the array of prices:

p[1]=1, p[2]=5, p[3]=8, p[4]=9, p[5]=10, p[6]=17, p[7]=18 

Which of the following statements is/are correct about R7?
(A) R7=18
(B) R7=19
(C) R7 is achieved by three different solutions
(D) R7 cannot be achieved by a solution consisting of three pieces


Answer: (A) (C)

Explanation: According to given data,

Number of piecesPossible max profits with combination of rod size 
77 (1, 1, 1, 1, 1, 1, 1)
610 (2, 1, 1, 1, 1, 1)
513 (2, 2, 1, 1, 1)
416 (2, 2, 2, 1)
318 (2, 2, 3)
218 (6, 1)
118 (7)

Therefore,

Option (A) and (C) are correct.

Refer – Cutting a Rod | DP-13, and solution – https://ide.geeksforgeeks.org/lbBeyHa3xd


Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :