Chocolate Manufacturing Company
All submissions for this problem are available.
A chocolate manufacturing company wants to buy boxes to pack chocolates. Boxes are available in two types, first one costs c1 and can hold n1 chocolates and the second one costs c2 and can hold n2 chocolates. Each box to be filled to its capacity. You have to find the best way to distribute the chocolates such that total cost is minimized.
The first line specifies the number of test cases.
For each test case, the first line of input specifies the total number of chocolate to be packed. (numbered 1 to 300,000,000). The next line contains c1 n1 c2 n2. A test case containing zero for the number of chocolates indicates termination of input.
For each test case in the input print a line containing the minimum cost solution (two
nonnegative integers m1 and m2, where mi = number of type i boxes required if one
exists. Otherwise print 0 0.
Input: 44 10 9 9 8 37 10 9 9 8 0 Output: 4 1 0 0
|Time Limit:||0.1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, GO, NODEJS|
Fetching successful submissions
If you are still having problems, see a sample solution here.