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...
-
(a) Can we see light that is 300 nm in wavelength? 500 nm in wavelength? (b) What is meant by the term complementary color? (c)What is the significance of complementary colors in understanding the...
-
Seventy-Two Inc., a developer of radiology equipment, has stock outstanding as follows: 80,000 shares of cumulative preferred 3% stock, $20 par and 400,000 shares of $25 par common. During its first...
-
Consider the three-component system consisting of acetaldehyde (1), hydrogen (2), and ethanol (3). The binary diffusivity values at \(548 \mathrm{~K}\) and \(101.3 \mathrm{kPa}\) are given in Example...
-
After the tangible assets have been adjusted to current market prices, the capital accounts of Brandon Newman and Latrell Osbourne have balances of $75,000 and $125,000, respectively. Juan Rivas is...
-
1. Describe the advantage of the creation of the Chong-Hua Institution for Economic Research. 2. What is the impact of tariffs imposed on Taiwan's imports by Mainland China? 3. Compare the Economic...
-
The Hokies Lunch Group PART A Fatma settled down for lunch at the Yank Sing Chinese restaurant. She was early and took the time to catch up on her e-mail. Soon she would be joined by Jasper and...
-
Read the Articles: " Bitcoin Barely Budges After Jobs Report. 'A Big Round of Volatility' May Still Be Ahead Actions ." by Barron's (Click on the link posted) and " This year may be pivotal for the...
-
A) Grounding is required to complete this method of charging B) rubbing ebonite rod with fur results in electrons transferred from fur to rod C) neutral electroscope becomes negative charged when top...
-
A 100 m wide river has a uniform current flow of 3.0 m/s east relative to the banks of the river. A boat leaving the south bank with a speed of 8.0 m/s relative to the water wants to arrive on the...
-
A 65 g unknown object lost 1332 J energy and its temperature dropped from 96.0 oC to 23.0 oC. What is its specific heat capacity(J/goC)
-
Each croquet ball in a set has a mass of 0.49 kg. The green ball, traveling at 13.7 m/s, strikes the blue ball, which is at rest. Assuming that the balls slide on a frictionless surface and all...
-
A generator coil is rotated through one-fourth of a revolution (from 0-0 to 0 -90") in 20 ms. The 239-turn circular coil has a 4.3 cm radius and is in a uniform 1.56 T magnetic field which initially...
-
Selected accounts with amounts omitted are as follows: Work in Process Aug. 1 Balance 31 Direct materials 276,660 Aug. 31 Goods finished 160,530 31 Direct labor 32,500 31 Factory overhead Factory...
-
Compile data on consumption and expenditures for the following categories in 30 different countries: (1) food and beverages, (2) clothing and footwear, (3) housing and home operations, (4) household...
-
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?
-
Explain the properties of the restricted least squares estimator. In particular, how do its bias and variance compare with those of the unrestricted, ordinary, least squares estimator?
-
Explain the issues that need to be considered when choosing a regression model.
-
Identify collinearity and explain its consequences for least squares estimation.
Study smarter with the SolutionInn App