Write a C code for this question. Recently Max has got himself into popular CCG BrainStone. As
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a C code for this question.
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)
Code for the given problem is as follow include include typedef long long int lli struct node l... View the full answer
Related Book For
Statistics for Business Decision Making and Analysis
ISBN: 978-0321890269
2nd edition
Authors: Robert Stine, Dean Foster
Posted Date:
Students also viewed these algorithms questions
-
Please write a C Code for this problem. Please do not submit C++ or Python Code.
-
Write a C code for Insertion Sort Insert element into sorted list Given a sorted list with an unsorted number in the rightmost cell, can you write some simple code to insert into the array so that it...
-
Write a C code for Bubble Sort Given an array of integers, sort the array in ascending order using the Bubble Sort algorithm above. Once sorted, print the following three lines: 1. Array is sorted in...
-
Mr. Paulo Rodriguez, a fund manager of The Blackstone Group Inc. holds a portfolio with a current value of RM7.83 million. The cash index currently stands at 1,075 points. He fears that the market...
-
Two possible reactions of MnO 4 with H 2 O 2 to produce O 2 and Mn 2 are (a) Complete the half-reactions for both schemes by adding e - , H 2 O, and H - and write a balanced net equation for each...
-
An electron is in the n = 5 state. What is the smallest possible value for the angle between the z component of the orbital angular momentum and the orbital angular momentum?
-
Derive the solutions for transient concentration profiles in the two-bulb apparatus (Example 21.5 in the text) for the binary case, and show that the multicomponent case can be derived as an...
-
Office Express sells office suppliers to businesses on a membership basis-i.e., walk-in customers without a membership are not allowed. The company delivers supplies directly to the purchaser as long...
-
A particular investment generates the following cash flows: $5 Million end of year one; $5 Million end of year two; $5 Million end of year three; $7 Million end of year four; and $10 Million end of...
-
On January 1, Boston Company completed the following transactions (use a 7% annual interest rate for all transactions): ( EV of $1. PV of $1. EVA of $1. and PVA of $1) (Use the appropriate factor(s)...
-
The athletic director of a university wants to develop an exercise program available to students campus-wide. To get a sense of their exercise habits beforehand, he administered a survey that asked,...
-
Prepare the journal entry to record the payment of interest and the discount amortisation on December 3 1 , 2 0 2 2
-
Find f'(x) and simplify. f(x) = X x+12
-
What would the nurse need to document for each of the clients she is caring for? 3) Discuss the communication between the nurse and patient, and the nurse and family member, would you have...
-
Density is how much you have in a volume. If I put 13.32 kilogram(s) of carbon dioxide in an empty 1.44 m 3 bottle, what is the density of the gas after filling it? Round to nearest 2 decimals.
-
What role do the generally accepted auditing standards ( GAAS ) play in the audit function?
-
Laporte Engineering Company leased a machine on January 1, 2017, under a contract calling for four annual payments of $100,000 on December 31, 2017 through 2020. The machine becomes the property of...
-
Which internal control principle is especially diffi cult for small organizations to implement? Why?
-
The relevance of variance and covariance developed for random variables in this chapter carries over to the analysis of returns on real stocks. The data file daily _ stocks includes the daily...
-
The normal quantile plot of daily stock returns for General Motors during 19921993 (507 trading days) shows an anomaly, a flat spot at zero. (a) Whats happened? (b) Why does the anomaly not appear in...
-
States in the United States are allowed to set their own rates for sales taxes as well as taxes on services, such as telephone calls. The scatterplot below graphs the state and local taxes charged...
-
Reconsider the data of Problem 31. Data from Problem 31 The following three investment opportunities are available. The returns for each investment for each year vary, but the first cost of each is...
-
The following three investment opportunities are available. The returns for each investment for each year vary, but the first cost of each is $20,000. Based on a future worth analysis, which...
-
Explain the concept of a control variable and the assumption necessary for a control variable to be effective.
Study smarter with the SolutionInn App