Dynamic Programming

Answer & solution
Official answer: A; C
With R0=0 and Rn=max1≤i≤n(p[i]+Rn−i), the values R1,…, R7 are 1, 5, 8, 10, 13, 17, 18. Revenue18 is achieved by exactly the three unordered partitions 7; 6+1; 3+2+2. The last uses three pieces, so D is false, and 19 is not attainable. Hence A, C. Different orders of the same piece lengths are not counted as distinct cutting solutions.
Dynamic-programming pseudocode: R[0]=0; for length=1..7: R[length]=max(price[i]+R[length−i] for i=1..length). At length 7 the candidates for first piece sizes 1..7 are 18,18,18,17,15,18,18. Backtracking optimal candidates and sorting piece lengths gives {7},{1,6},{2,2,3}; different first-piece choices can lead to the same sorted partition, so count each only once. The recurrence is exhaustive because every nonempty cutting solution has some first piece and an optimally solved remainder.