Input 20 1 5 8 9 10 17 17 20 24 30 31 32 33 34 35
Fantastic news! We've Found the answer you've been seeking!
Question:
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
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
include include include int maxint a int b return a b a b and price as prices of diffe... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these algorithms questions
-
Describe a situation in which you had to make a difficult ethical decision in the workplace. It might have been the decision not to do something you were tempted to do, or it might have a time when...
-
Ayayai Company prepares its statement of cash flows using the direct method for operating activities. For the year ended December 31, 2024, Ayayai Company reports the following: Sales on account...
-
A road building company is purchasing an excavator for $500,000. The corporate tax rate is 45% and the expected after-tax rate of return is 12%. What would be the present value of the future tax...
-
Understanding the history and background of your company gives you valuable insights as to what to do and what not to do going forward. A brief written summary of the background and history of the...
-
A 1.34-kg object moves along the x axis, subject to the potential energy shown in Figure 8-34. If the object's speed at point C is 1.25 m/s, what are the approximate locations of its turning points?...
-
How could a prisoner on death row establish that his or her death sentence was the result of racial discrimination?
-
Utta Inc. allows each employee to earn 15 paid vacation days each year with full pay. Unused vacation time can be carried over to the next year. If not taken during the next year, unused vacation...
-
Kohler Corporation reports the following components of stockholders equity on December 31, 2013: Common stock $ 10 par value, 100,000 shares authorized, 40,000 shares issued and outstanding . . . . ....
-
What is the discounted value of ?$1544.00 paid at the end of every six months for 8 years if interest is 8% per annum compounded annually? The discounted value is ?$ ? . ?(Round the final answe...
-
1. Sharps Sandwich Shop has two conflicting quality issues speed and freshness. The premade sandwich system enhances speed; however, it has the potential of affecting freshness. What type of system...
-
Which of the following database programming techniques iscommonly used with object-oriented programming languages? a. Procedural SQL b. API c. Embedded SQL
-
Below is the amount of widgets that Adam, Robert, and Karl are each willing to make at three different prices. Producer $1 per widget $2 per widget $3 per widget Adam 3 Robert 5 Karl 3 6 7 9 a. What...
-
A depreciable asset with a cost of $40550 has a residual value of $3000 and a useful life of 5 years. Total estimated units of output are 75100 and in year 1 a total of 5400 units were produced....
-
How many kilograms of lead must be added to 71 kg oftin to yield a Pb-Sn alloy having a composition of 71 at%Sn-29 at% Pb? mpb= _____ kg
-
Kayla consumes about 100 grams of protein each day. Of this, 25 grams is broken down and used to make ATP, and 25 grams is used to synthesize (make) body fat. What does this tell you about Kayla's...
-
During the year, Park Corporation had 100.000 shares of $10 par value common stock and 20,000 shares of 89. $50 par value convertible preferred stock outstanding. Each share of preferred stock may be...
-
Assume that DESCO has expected return for the market is 19 percent; standard deviation of market return is 23 percent; risk-free rate is 4.75 percent and correlation between DESCO stock and the...
-
Describe the general ways that the revised Form 990, applicable for tax year 2008 and beyond, is different from previous versions.
-
Cypress Corporation has regular taxable income of $170,000 (assume annual gross receipts are greater than $5 million) and regular tax liability of $49,550 for 2012. The corporation also has tax...
-
Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is...
-
Carl and Jenny adopt a Russian orphan. The adoption takes 2 years and two trips to Russia and is final in 2012. They pay $6,000 in 2011 and $7,500 in 2012 of qualified adoption expenses, and have AGI...
-
You are to draw up a consolidated balance sheet from the following details as at 31 December 19X9. During the year P had sold goods which had cost \( 150\) to S for \( 240\). None of these goods had...
-
Draw up a consolidated balance sheet from the following details as at 31 December 19 X8. At the balance sheet date S2 owed S1 \( 500\) and P owed S2 \( 900\). During the year P had sold goods costing...
-
Draw up a consolidated balance sheet as at 31 December \(19 \mathrm{X} 4\) from the following: P Balance Sheet as at 31 December 19X4 Investment in subsidiary: 6,000 shares bought 31.12.19X3 Fixed...
Study smarter with the SolutionInn App