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...
-
How different are the rates of return of money market accounts and certificates of deposit that vary in length of their term? The data in MMCD Rate contain these rates for banks in a suburban area....
-
An airplane has a mass of 1.60 X 104 kg, and each wing has an area of 40.0 m2. During level flight, the pressure on the lower wing surface is 7.00 X 104 Pa. Determine the pressure on the upper wing...
-
Match the following concepts: goal, process, function, scenario, business system, information system, grocery store, check-out system, actors, role.
-
Here is the ledger for Stampfer Co. Instructions(a) Reproduce the journal entries for only the transactions that occurred on October 1,10, and 20, and provide explanations for each.(b) Prepare a...
-
Assume the following excerpts from a company s balance sheet: Beginning Balance Ending Balance Bonds payable $ 5 0 0 , 0 0 0 $ 6 5 0 , 0 0 0 Common stock $ 9 5 0 , 0 0 0 $ 9 5 0 , 0 0 0 Retained...
-
Herb and Alice are married and file a joint return. Herb is 74 years old and Alice is 70. Neither are blind. Both Herb and Alice are retired. Herb works part time as a greeter. Herb earned $15,000 in...
-
You are hired with a starting annual salary of $55,000. As part of your signing package, you are promised your compensation will increase by 3.5% per year for the first four years. Write an equation...
-
3 / 3 pts With regard to the OIP, the composition of the optimal international portfolio is
-
An auditor tests internal controls over purchase orders by choosing a sample of purchase orders from the first quarter of the year. The auditor determines the controls over the purchase orders have...
-
The securitization of mortgages does not involve pooling mortgage loans for sale in the financial markets
-
Indicate if a Deferred Tax Asset (DTA), Deferred Tax Liability (DTL) or permanent (P) difference would result when difference originates. For permanent differences, indicate if adding (P+) or...
-
Treasury bills, which are issued by the US Treasury, are purchased at ??? its bid price a discount price its offer price its face value a premium price
-
explain the the following: Health care provider setting. Key players. Significant realities. Highlight the main problems or challenges of the case. Suggest outcomes or solutions. State these in terms...
-
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?
-
Personalized medicine may be used a. to characterize types of tumors. b. to predict the outcome of certain types of cancers. c. to determine the proper dosage of drugs. d. in all of the above.
-
Tumor-suppressor genes promote cancer when a. they are overexpressed. b. they are expressed in the wrong cell type. c. their function is inactivated. d. they are expressed at the wrong stage of...
-
Which of the following is a type of genetic change that could produce an oncogene? a. Missense mutation b. Gene amplification c. Chromosomal translocation d. All of the above can produce an oncogene.
Study smarter with the SolutionInn App