CURDPROD - CURD PRODUCERS
A curd manufacturing factory owns curd producing machines of different qualities. A curd producer of quality q produces 1 unit of curd in q units of time.
For example, a curd producer of quality 5 produces 1 unit of curd at time 5, 1 unit of curd at time 10 and so on.
Given the qualities of all the machines, find the minimum time required to produce T units of curd.
Input
The first line consists of an integer t, the number of test cases. For each testcase, the first line consists of 2 integers n and T, the number of machines and the target amount of curd. The next n lines consists of integers representing the qualities of the producer machines.
Output
For each test case, find the minimum time required to produce the target amount of curd.
Input Constraints:
1 <= t <= 10^2
1 <= n <= 10^4
1 <= T <= 10^9
1 <= quality of each machine <= 10^9
Note: Note that a quality 5 producer has produced only 1 curd at time 9 and not 1.8.
Sample
Input: 3 2 3 5 10 3 1000000 1 2 3 1 1000000000 1000000000 Output: 10 545455 1000000000000000000
hide comments
shikhargarg:
2014-12-22 07:44:56
can two machine operates simultaneously???? how output of first testcase is 3 ??
|
Added by: | cegprakash |
Date: | 2014-11-06 |
Time limit: | 2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: BF |
Resource: | Inspired from http://www.spoj.com/AU7/problems/AU7_2/ |