Code in C for this question statement. Recently Max has got himself into popular CCG BrainStone. As
Fantastic news! We've Found the answer you've been seeking!
Question:
Code in C for this question statement.
Transcribed Image Text:
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them: Max owns n creatures, ith of them can be described with two numbers - its health hp and its damage dmg Max also has two types of spells in stock: 1. Doubles health of the creature ( hp;= hp /2): 2. Assigns value of health of the creature to its damage ( dmg= hp ). Spell of first type can be used no more than a times in total, of the second type – no more than b times in total. Spell can be used on a certain creature multiple times. Spells can be used in arbitrary order. It isn't necessary to use all the spells. Max is really busy preparing for his final exams, so he asks you to determine what is the maximal total damage of all creatures he can achieve if he uses spells in most optimal way. Input The first line contains three integers n, a, b (1 sns2-105, 0 sas 20, 0sbs2-105) – the number of creatures, spells of the first type and spells of the second type, respectively. The i-th of the next n lines contain two number hp jand dmg ,(1 s hp ; dmg s 10) – description of the i-th creature. Output Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them: Max owns n creatures, ith of them can be described with two numbers - its health hp and its damage dmg Max also has two types of spells in stock: 1. Doubles health of the creature ( hp;= hp /2): 2. Assigns value of health of the creature to its damage ( dmg= hp ). Spell of first type can be used no more than a times in total, of the second type – no more than b times in total. Spell can be used on a certain creature multiple times. Spells can be used in arbitrary order. It isn't necessary to use all the spells. Max is really busy preparing for his final exams, so he asks you to determine what is the maximal total damage of all creatures he can achieve if he uses spells in most optimal way. Input The first line contains three integers n, a, b (1 sns2-105, 0 sas 20, 0sbs2-105) – the number of creatures, spells of the first type and spells of the second type, respectively. The i-th of the next n lines contain two number hp jand dmg ,(1 s hp ; dmg s 10) – description of the i-th creature. Output
Expert Answer:
Answer rating: 100% (QA)
Well structured code for this problem in C is as fo... View the full answer
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
C code only for this question please: You learned about priority queues recently and are now ready to solve problems using them! So here's one. Suppose you have an integer array A. For each index i,...
-
Two garments factories produce output according to the same production function q=k4 where qis output, kis capital and lis labour. However, Factory 1 uses more labour than Factory 2 so that = 1600...
-
You are finishing up your first year of work in the real world. Budgeting is becoming second nature. You've budgeted for regular maintenance for your vehicle. You've chosen to have your oil changed...
-
The simple truss shown has the following dimensions: H1 = 1.90 in; H2 = 1.60 in; L0=31 in; L2 = 14 in; D1 = 0.76 in; D2 = 0.86 in. Both supporting bars have a depth of 0.5 in. If the maximum...
-
1. What is the equity premium puzzle? Can you give a personal example? 2. Why do you suppose that work on self-control problems such as procrastination is catching on most quickly? Can you provide an...
-
Sato Inspection Services is in its second month of operations. You have been given the following journal entries regarding its January 2020 transactions. Required a. Set up the following accounts...
-
For the finite difference scheme in Problem 4: a) Write the formulas for the Gauss-Seidel algorithm in terms of the grid point values. b) Prove convergence of the Gauss-Seidel iteration procedure....
-
A completed worksheet for The King Group is shown on the bottom of these two pages. INSTRUCTIONS 1. Record balances as of December 31, 2016, in the ledger accounts. 2. Journalize (use 3 as the page...
-
What is a variance frontier? and how would you factor the risk free rate into the calculation?. Construct two minimum variance frontiers-(1) using the U.S. and unhedged European markets and (ii)...
-
For a short time, the 250-kg roller-coaster car with passengers is traveling along the spiral track at a constant speed of v = 8 m/s. If the track descends d = 12 m for every full revolution, = 2...
-
KidzConnect Pte Ltd recently collaborated with a technology company to produce a smart wearable that can be clipped onto a baby's clothing to monitor his/her health. The smart wearable can measure a...
-
A rocket takes off vertically from the Launchpad with no initial velocity but a constant upward acceleration of 2.25 m/s. At 15.4 s after blastoff, the engines fail completely so the only force on...
-
Westerville Company reported the following results from last year's operations: Sales Variable expenses Contribution margin Fixed expenses. Net operating income Average operating assets $ 1,300,000...
-
Your CEO has asked you to present to senior leadership at SLUHE about future trends in Training & Development. Choose 2 specific trends that will impact the future of the field. Explain these trends,...
-
A rock is dropped from the top of a vertical cliff and takes 3.00 s to reach the ground below the cliff. A second rock is thrown vertically from the cliff, and it takes this rock 2.00 s to reach the...
-
Use the information in the following adjusted trial balance for the Wilson Trucking Company. Account Title Cash Accounts receivable Office supplies Trucks Accumulated depreciation-Trucks Land...
-
Sandy Bank, Incorporated, makes one model of wooden canoe. And, the information for it follows: Number of canoes produced and sold Total costs Variable costs Fixed costs Total costs Cost per unit...
-
The Adjusted Trial Balance columns of a 10-column work sheet for Webber Co. follow. Complete the work sheet by extending the account balances into the appropriate financial statement columns and by...
-
a. If fortune cookies sell for $10 a box and Lins offers its cookies for sale at $10.50 a box, how many boxes does it sell? b. If fortune cookies sell for $10 a box and Lins offers its cookies for...
-
Describe the prisoners dilemma game and explain why the Nash equilibrium delivers a bad outcome for both players.
-
How do external costs prevent a competitive market from allocating resources efficiently?
-
A 10 -year, \(7 \%, \$ 1,000\) bond (cash interest payable \(3.5 \%\) semiannually) is sold to yield \(6 \%\) interest. Compute the bond selling price.
-
Rowe Corporation authorized \(\$ 600,000\) of \(8 \%\) (cash interest payable semiannually) 10 -year bonds. The bonds were dated January 1, 2020. Interest dates are June 30 and December 31. Assuming...
-
Yale Corporation issued to Zap Corporation \(\$ 60,000,8 \%\) (cash interest payable semiannually on June 30 and December 31) 10 -year bonds dated and sold on January 1,2020 . Assume that the company...
Study smarter with the SolutionInn App