Please Write C code: With the IPL going on, the Sharjah Cricket Stadium management is trying to
Fantastic news! We've Found the answer you've been seeking!
Question:
Please Write C code:
Transcribed Image Text:
With the IPL going on, the Sharjah Cricket Stadium management is trying to figure out the optimal strategy for ticket sales.* There are M rows in the stadium with different seating capacities. They may or may not be equal. The price of the ticket depends on the row. If the row has K (always greater than 0) vacant seats, then the price of the ticket will be K dollars. Now, every fan standing in the line will get a ticket one by one. Given the seating capacities of different rows, find the maximum possible dollars that the stadium will gain with the help of the ticket sales. Input: The first line consists of M and N. M denotes the number of seating rows in the stadium and N denotes the number of football fans waiting in the line to get a ticket for the match. Next line consists of M space separated integers X[1,X[21,X[31. X[M] where X[i] denotes the number of empty seats initially in the ith row. Output: Print in a single line the maximum dollars the stadium stands to gain. Constraints: 1 With the IPL going on, the Sharjah Cricket Stadium management is trying to figure out the optimal strategy for ticket sales.* There are M rows in the stadium with different seating capacities. They may or may not be equal. The price of the ticket depends on the row. If the row has K (always greater than 0) vacant seats, then the price of the ticket will be K dollars. Now, every fan standing in the line will get a ticket one by one. Given the seating capacities of different rows, find the maximum possible dollars that the stadium will gain with the help of the ticket sales. Input: The first line consists of M and N. M denotes the number of seating rows in the stadium and N denotes the number of football fans waiting in the line to get a ticket for the match. Next line consists of M space separated integers X[1,X[21,X[31. X[M] where X[i] denotes the number of empty seats initially in the ith row. Output: Print in a single line the maximum dollars the stadium stands to gain. Constraints: 1
Expert Answer:
Answer rating: 100% (QA)
include include int main printfSample Input int mn m numb... View the full answer
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
Please write a C Code for this problem. Please do not submit C++ or Python Code.
-
Code Force Problem 1311B: https://codeforces.com/problemset/problem/1311/B Please write a C code for this question.
-
Code Force Problem 1133C: https://codeforces.com/problemset/problem/1133/C Please write a C code for this question. C. Balanced Team time limit per test: 2 seconds memory limit per test: 256...
-
Consider a regulators objective formulized as: (a) Show that at most one of the four constraints (incentive compatibility and participation) can be binding in this case, that the high cost firms fee...
-
Consider the block diagram in Figure P3.21. (a) Verify that the transfer function is (b) Show that a state variable model is given by G(s) = Y(s, h,sta + ais + a 0 ao a y=[1 LE 0]x. Co FIGURE P3.21...
-
A booster pump is used to move water from the basement equipment room to the twelfth floor of an apartment building at the rate of 363 kg/min. The elevation change is 40 m between the basement and...
-
In the optical system shown in Fig. 7-4p, a square incoherent source ( \(L \times L\) meters) lies in the source plane. The object consists of two pinholes separated in the \(\xi\) direction by...
-
OBrien Corporation is a midsize, privately owned, industrial instrument manufacturer supplying precision equipment to manufacturers in the Midwest. The corporation is 10 years old and uses an...
-
What are the thermodynamic and kinetic considerations in ultrasonic-assisted extraction, and how does this method enhance the efficiency and speed of extraction compared to conventional techniques ?
-
Jerry Stevenson is the manager of a medical clinic in Scottsdale, AZ. He wants to analyze patient data to identify high-risk patients for cardiovascular diseases. From medical literature, he learned...
-
. You have just purchased a 10-year, $1,000 par value bond. The coupon rate on this bond is 8 percent annually, with interest being paid each 6 months. If you expect to earn a 10 percent simple rate...
-
For each of the situations listed, identify the primary standard from the IMA Statement of Ethical Professional Practice that is violated (competence, confidentiality, integrity, or credibility). 1....
-
A material is required for a disposable fork for a fast food chain that is conscious of its environmental image. List the objective and the constraints that you would see as important in this...
-
Imagine the following. You go to an e-commerce site and buy a pair of running shoes. You are anxious to receive the shoes because the ones you are wearing are worn out. The shoes arrive in three...
-
The standard CD ('Jewel' case) cracks easily and, if broken, can scratch the CD. Jewel cases are made of injection moulded polystyrene, chosen because it is transparent, cheap and easy to injection...
-
Ultraprecise bearings that allow a rocking motion make use of knife-edges or pivots. As the bearing rocks, it rolls, translating sideways by a distance that depends on the radius of contact. The...
-
A fund manager has a portfolio of two-year 5% coupon bonds with a total face value of $30 million. The coupons are paid semi-annually (s.a.). Concerned that a rise in interest rates will reduce the...
-
Why can wastewater treatment requirements in Hawaii be less stringent than those in most locations on the U.S. mainland?
-
Consider the 2013 declined loan data from LendingClub titled RejectStatsB2013. Similar to the analysis done in the chapter, lets scrub the debt-to-income data. Because our analysis requires risk...
-
We know that a Balanced Scorecard is comprised of four components: financial (or stewardship), customer (or stakeholder), internal process, and organizational capacity (or learning and growth). What...
-
What approach should a company make if its continuous audit system has too many alarms that are false positives? How would that approach change if there are too many missed abnormal events (such as...
-
The chief goal of the private sector is effciency.Why? The primary focus of the public sector is equity. Why? It is quite possible to be highly effcient yet ineffective. It is also possible to be...
-
Why is healthcare reform such a contentious issue in the United States? Why have public and private efforts been unsuccessful in fully addressing the challenge of affordable health care? What role(s)...
-
Drawing on economic theory, what kinds of market failure underlie the worlds most pressing problems? Examine three examples: hunger, groundwater contamination, and literacy.
Study smarter with the SolutionInn App