Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C code for this question. Recently Max has got himself into popular CCG BrainStone. As BrainStone is a pretty intellectual game, Max has

Write a C code for this question.

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

Step by Step Solution

3.42 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

Code for the given problem is as follow include include typedef long long int lli struct node l... 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

Statistics For Business Decision Making And Analysis

Authors: Robert Stine, Dean Foster

2nd Edition

978-0321836519, 321836510, 978-0321890269

More Books

Students also viewed these Algorithms questions