You have n clubs that you can use to break a stone. The strength of the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You have n clubs that you can use to break a stone. The strength of the stone is d. Club i has power Pi, and when this club strikes the stone, the strength of the stone is decreased by Pi. If d < P; thend becomes zero and the stone is considered broken. When you use club i, it's power also reduces by half. P in particular the power becomes 2 You have k chances to hit the stone. If it is not possible to break the stone with k opportunities to hit it, then print -1. Otherwise, output the smallest number of hits required. INPUT • First line contains 3 integers, n, d, k • Second line contains n space separated positive integers, denoting the powers of the n clubs. OUTPUT Print the number of hits required (less than or equal to k). • Or-1 if it is not possible to destroy the door within k trials. CONSTRAINTS • 1sns 105 • 1sds 1017 1sks 105 OSP, s 1014 SAMPLE INPUT 3 30 4 10 5 11 SAMPLE OUTPUT 4) You have n clubs that you can use to break a stone. The strength of the stone is d. Club i has power Pi, and when this club strikes the stone, the strength of the stone is decreased by Pi. If d < P; thend becomes zero and the stone is considered broken. When you use club i, it's power also reduces by half. P in particular the power becomes 2 You have k chances to hit the stone. If it is not possible to break the stone with k opportunities to hit it, then print -1. Otherwise, output the smallest number of hits required. INPUT • First line contains 3 integers, n, d, k • Second line contains n space separated positive integers, denoting the powers of the n clubs. OUTPUT Print the number of hits required (less than or equal to k). • Or-1 if it is not possible to destroy the door within k trials. CONSTRAINTS • 1sns 105 • 1sds 1017 1sks 105 OSP, s 1014 SAMPLE INPUT 3 30 4 10 5 11 SAMPLE OUTPUT 4)
Expert Answer:
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
Below is a less than or equal to cumulative relative frequency table showing the results of a National Rifle Association survey of gun ownership in Oregon. The table is based on data collected from...
-
Describe two broad approaches that companies can use to generate additional revenues.
-
Describe two broad approaches that companies can use to improve productivity.
-
Assume you have just been hired as a business manager of PizzaPalace, a regional pizza restaurant chain. The companys EBIT was $120 million last year and is not expected to grow. PizzaPalace is in...
-
A conveyor drive system to produce translation of the load is shown in Figure. The reducer is a gear pair that reduces the motor speed by a factor of 10:1. The motor inertia is I = 0.002 kg m2. The...
-
Benetton has entered into a quantity flexibility contract with a retailer for a seasonal product. If the retailer orders O units, Benetton is willing to provide up to another 35 percent if needed....
-
In February 2022, as a response to its invasion of Ukraine, Russia faced unprecedented sanctions from Western countries representing more than half the worlds economic output. What is the expected...
-
Think about the pricing methods described in this chaptermarkup pricing, target-return pricing, perceived value pricing, value pricing, going-rate pricing, and auction-type pricing. As a consumer,...
-
Describe a time when you had to stop a client's violent or destructive behaviour. What did you do? What would you have done differently?
-
The restaurant owner Lobster Jack wants to find out what the peak demand periods are, during the hours of operation, in order to be better prepared to serve his customers. He thinks that, on average,...
-
British Airways faced marketing challenges over the last couple of years. You are to provide an original case study in which you critically evaluate a significant marketing challenge that British...
-
Brett Simons, age 45, is single and resides at 66 Mason Lane,Waterbury, CT 06069. His social security number is123-45-6788. Brett has two children, Alec (age 17) and Grace(age 8), and their social...
-
An X - ray photon with a wavelength of 0 . 9 9 5 nm strikes a surface. The emitted electron has a kinetic energy of 9 5 7 eV . What is the binding energy of the electron in kJ / mol ? [ Note that KE...
-
You borrow $24,260 from a bank and agree to pay them back over 10 years making annual payments. The interest rate on the loan is 9.88%. What is your payment amount? Round your answer to the nearest...
-
The risk-free rate is 6% and the expected rate of return on the market portfolio is 13%. * Calculate the required rate of return on a security with a beta of 1.25. (Do not round intermediate...
-
Imagine it is January, 2022, and you hold 10,000 shares of Apple Inc. (ticker symbol: AAPL) and you are considering entering into a covered call writing strategy. You gather the following...
-
Ratio Analysis Compute the Following: Using Words, Show Formula (i.e. Owner's Equity = Assets - Liabilities) Show Calculations Using an Excel Formula Current Ratio Debt to Total Assets Gross Profit...
-
The column shown in the figure is fixed at the base and free at the upper end. A compressive load P acts at the top of the column with an eccentricity e from the axis of the column. Beginning with...
-
What is multiple regression? Specifically, what is "multiple" about it, and how does the formula for multiple regression appear? In your indication of the formula, identify the various terms and also...
-
1. What should Cory consider doing with the information in this case before he actually begins to write the report? Name some specific issues Cory should address. 2. Should Cory include the standard...
-
Why is it important for the researcher and the marketing manager to discuss the accuracy level associated with the research project at hand?
-
Due to the Covid recession of 2020, the U.S. government budget changed from smaller deficits to very large deficits. What impact would this have on the net exports and private sector balances, all...
-
Verify the log-likelihood in equation (16.4) for the Tobit model. In L = = In { 1-0 (x-di)} 1:y=di 122. + (y; - x) 02 (16.4) i:y;>di
-
Verify the likelihood in equation (16.5) for the two-part model. n2. (16.5) -(-)-(-2)/02 L = [] {(p;)" (1 p; )'-'} [[ ( i=1 ri=1
Study smarter with the SolutionInn App