J1 Dabbawalas Dilemma
All submissions for this problem are available.
The Dabbawalas Dilemma
The Dabbawalas in Mumbai have started finding the ever-increasing workload a bit too much lately.
Flooded with parcels every morning, they have decided to ask us programmers for some help.
They have to
transport n number of food parcels in food containers.
There are two types of food containers
- Type 1: Price of the container is p1 and can contain exactly n1 food parcels.
- Type 2: Price of the container is p2 and can contain exactly n2 food parcels.
Each of the containers is to be filled to its capacity and the cost of purchasing them should be minimised
The input file may contain multiple test cases. Each test case begins with a line containing the integer n
(n <= 20,000). The second line contains p1 and n1, and the third line contains p2 and n2 where ( 0 < p1, p2,
n1, n2 < 20,000 ).
A test case in which n is zero in the first line ends the input sequence.
Output the number of type 1 containers and type 2 containers required if a solution exists.
If not Output " Unsuccessful " without the double quotes.
Input: 10 2 2 3 4 18 4 7 2 5 0 Output: 1 2 Unsuccessful
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP 4.3.2, CPP 6.3, CPP14, GO, NODEJS|
Fetching successful submissions
If you are still having problems, see a sample solution here.