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
yash9274: 2020-09-23 13:03:40

hint: simple sort and think greedy
note: make sure u consider n=1.

abhineelnandi: 2020-09-04 11:28:52

did in just one word in j !!!!

abhiram_varma: 2019-02-24 16:34:58

what !!!!! just sorting. simple ac in one go

agn4: 2018-12-31 18:54:35

NOTE: tricky test case where n=1

shubham9261: 2017-08-09 21:55:32

randomized_quick_sort rocks

Shubham Jadhav: 2017-05-07 11:22:13

Move this to tutorial

vaibhavgupta15: 2016-10-22 08:28:32

remember not to use ascending sort!

shubhama003: 2016-10-13 16:37:47

really easy problem.
AC in one go...

adarshkr532: 2016-10-12 06:21:11

very easy ques......... got ac in first attempt

ayon26: 2016-09-23 18:35:23

who ever in this comment section said that they've done this program and it's very "easy"...none of them has done it... #liars


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