Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please Write C code: With the IPL going on, the Sharjah Cricket Stadium management is trying to figure out the optimal strategy for ticket sales.*
Please Write C code:
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
Step by Step Solution
★★★★★
3.34 Rating (160 Votes )
There are 3 Steps involved in it
Step: 1
include include int main printfSample Input int mn m numb...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started