Question: 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,

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!