AE1B - Tables


Byteman works as a carpenter. He has just received an order for s pine-wood tables. Although he has plenty of pine-wood boards in his workshop, he has just run out of screws. Therefore he needs to walk to the warehouse and bring back some boxes with screws. What is the minimum number of boxes that he needs to bring in order to have enough screws to make the tables?

Input

The first line of the standard input contains three integers n, k, and s (1 ≤ n, k, s ≤ 1000) separated with single spaces. They denote the number of boxes with screws in Byteman's warehouse, the number of screws needed to make a table and the number of tables to be made by Byteman, respectively. The second line contains n (not necessarily different) integers ai (1 ≤ ai ≤ 1000) separated with single spaces, such that ai is the number of screws in the ith box in the warehouse.

Output

The first and only line of the standard output should contain a single integer - the minimal number of boxes with screws that Byteman needs to bring from his warehouse in order to make s tables. You may assume that Byteman has enough screws in the warehouse to make all tables.

Example

For the input data:

5 6 3
3 9 5 7 3

the correct result is:

3

Explanation of the example. To make three tables, each of which requires six screws, Byteman has to bring three boxes with screws from the warehouse. These can be either the ones containing 3, 7 and 9 screws, or the ones with 9, 5 and 7 screws.

Task author: Jakub Lacki.


hide comments
giriprasad kemburu: 2016-08-04 07:11:48

Easy problem use of sorting.
AC in first go:):):)

Nallagatla Manikanta: 2015-10-22 20:56:24

love python just 7 lines in python :)

Abhishek Naik: 2015-04-26 14:08:49

But what if the total number of screws that he has is less than the total number of those that he requires? Eg:
5 6 3
1 1 1 1 1

Last edit: 2015-04-26 14:10:17
Sahil Kharb: 2014-11-18 10:41:44

ad hoc :-P
It should be in tutorials.

excursionist: 2014-06-24 22:44:41

GOT AC :D
in first go !!!
same as stamp ;)

Norman Fernandez: 2014-03-13 06:54:22

Special case: when the minimum of boxes is one, this is critical for the las judge...

shashank: 2014-01-29 13:59:34

AC in first Attempt

(Tjandra Satria Gunawan)(曾毅昆): 2013-08-20 22:25:29

No, if you just copy STAMPS solution, you'll get WA. Got 1 WA because I believe some comments below :-P

ankita: 2013-05-02 12:44:10

where is the tutorial for this problem available?
--ans(francky)--> This problem is a tutorial problem by itself, you have to solve it and consider this task as a tutorial ;-) Good luck.

Last edit: 2013-05-02 12:50:24
Prakash: 2012-09-19 19:56:30

Easy one!

Last edit: 2013-07-31 18:26:02

Added by:Race with time
Date:2009-05-03
Time limit:0.400s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Algorithmic Engagements 2009