Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Input 20 1 5 8 9 10 17 17 20 24 30 31 32 33 34 35 36 37 38 39 40 2 3 5

A rod cutting company streling corporation will cut rods of specific lengths only. Given a list of lengths by 
Input 20 1 5 8 9 10 17 17 20 24 30 31 32 33 34 35 36 37 38 39 40 2 3 5
Expected output 50

A rod cutting company streling corporation will cut rods of specific lengths only. Given a list of lengths by which this company will make rods, a rod of length 'n' and list of prices of each piece of rod that shall be cut by the company, write an algorithm and implement it using top down dynamic programming to find maximum revenue that shall be generated. In that case, give a penalty of Rs 1 for each meter of the residue. Input Format First line contains the length of the rod, n Next line contains price of various lengths of rods from 1 to n Next line cotains the number of preferred lengths Next line contains the preferred lengths separated by a space Output Format Print the maximum revenue that may be generated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

include include include int maxint a int b return a b a b and price as prices of diffe... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Algorithms questions

Question

3. On the playground, raise a hand or whistle to indicate Line up.

Answered: 1 week ago