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...
-
An actual refrigerator operates with a COP that is half the Carnot COP. It removes 10 kW of heat from a cold reservoir at 250 K and dumps the waste heat into the atmosphere at 300 K. (a) Determine...
-
After winning the TV show competition Star Chef, Adriana started a cooking school, Adrianas Apron. Adrianas Apron prepares monthly financial statements. The following are the transactions for the...
-
Alternate Coding Schemes for the Regression Approach to Analysis of Variance. Consider Eq. (8.18), which represents the regression model corresponding to an analysis of variance with three treatments...
-
Two cars, A and B, travel in a straight line. The distance of A from the starting point is given as a function of time by >At) = at + pt, with a = 2.60 m/s and p = 1.20 m/s. The distance of B from...
-
1) Give examples of three bond market indices? 2) Suppose you have $100,000 to invest and you are planning invest in New Zealand and in SriLanka. How will your decision to invest differ between...
-
Gabrielle receives 52 paychecks each year. She always deposits a specific percentage of her gross pay into her savings account. She also receives a bonus check, which is always more than $250, at the...
-
Do you believe that criminology and criminal justice theory should influence local, state, and federal criminal justice policy? Why or why not? What are two ways in which criminologists can help...
-
Express the speed \(1.08243 \times 10^{19} \mathrm{~nm} / \mathrm{y}\) in meters per second.
-
The prefix giga- means (a) 109, (b) 109, (c) 106, (d) 106.
-
Using a meterstick, a student measures a length and reports it to be 0.8755 m. What is the smallest division on the meterstick scale?
-
The only SI standard represented by material standard or artifact is the (a) meter, (b) kilogram, (c) second, (d) electric charge.
-
The cover of your physics book measures 0.274 m long and 0.222 m wide. What is its area in square meters?
-
Let g be a function from R to (0, 1) with g(x) ex = a) Show that f injective (one-to-one). 1+e b) Is f surjective (onto)?
-
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...
-
Given the four criteria necessary for a sale to be complete, which of the following is not one of those conditions? 1. Delivery has occurred or services rendered. 2. Cash has been collected. 3. The...
-
What is the difference between a business and a pure charity? Between a business and a governmental agency?
-
Sketch the \(P-V\) phase diagram for helium-4 using the sketch of the \(P-T\) phase diagram in Figure 4.3. Ps P S superfluid Pe T To T FIGURE 4.3 Sketch of the P-T phase diagram for helium-4. The...
Study smarter with the SolutionInn App