Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have n clubs that you can use to break a stone. The strength of the stone is d. Club i has power Pi,
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)
Step by Step Solution
★★★★★
3.34 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
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